Coder Social home page Coder Social logo

Comments (10)

barryvdh avatar barryvdh commented on May 18, 2024

Hmm, not really sure. Can you post the code from your form? The FILES array isn't usually shown. Are you passing the file to a view or something?
Just the regular config?

from laravel-debugbar.

Xpam avatar Xpam commented on May 18, 2024

This is the form:

{{ Form::open(array('url' => URL::to("downloadscp/upload"), 'files' => true)) }}
...some text inputs....
{{ Form::file("file") }}
{{ Form::submit("Save", array("class" => "btn fright")) }}
{{ Form::close() }}

Controller:

$validator = ValidatorService::validateFileUpload();
if ($validator->passes())
{
$file = Input::file("file");
$dl = new Download;
$dl->display_name = e(Input::get("display_name"));
$dl->filename = $file->getClientOriginalName();
$dl->mime = $file->getMimeType();
$dl->size = $file->getClientSize();
$dl->description = e(Input::get("description"));
$dl->link=null;
$dl->category_id = Input::get("category");
$dl->priority = Input::get("priority");
$dl->added_time = date("Y-m-d H:i:s");
$dl->added_by = Auth::user()->id;
$dl->num_downloads = 0;
$path = $file->getRealPath();
$dl->data = file_get_contents($path);
$dl->sha1 = sha1_file($path);
$dl->save();
success("File uploaded");
return Redirect::to("downloadscp/upload");
}
else
{
return Redirect::to("downloadscp/upload")->withErrors($validator)->withInput();
}

No special configuration as far as I know.

from laravel-debugbar.

barryvdh avatar barryvdh commented on May 18, 2024

And a specific file that is causing trouble, or all files?
Op 4 nov. 2013 18:02 schreef "Eurobattle.net" [email protected]:

This is the form:

{{ Form::open(array('url' => URL::to("downloadscp/upload"), 'files' =>
true)) }}
...some text inputs....
{{ Form::file("file") }}
{{ Form::submit("Save", array("class" => "btn fright")) }}
{{ Form::close() }}

Controller:

$validator = ValidatorService::validateFileUpload();
if ($validator->passes())
{
$file = Input::file("file");
$dl = new Download;
$dl->display_name = e(Input::get("display_name"));
$dl->filename = $file->getClientOriginalName();
$dl->mime = $file->getMimeType();
$dl->size = $file->getClientSize();
$dl->description = e(Input::get("description"));
$dl->link=null;
$dl->category_id = Input::get("category");
$dl->priority = Input::get("priority");
$dl->added_time = date("Y-m-d H:i:s");
$dl->added_by = Auth::user()->id;
$dl->num_downloads = 0;
$path = $file->getRealPath();
$dl->data = file_get_contents($path);
$dl->sha1 = sha1_file($path);
$dl->save();
success("File uploaded");
return Redirect::to("downloadscp/upload");
}
else
{
return
Redirect::to("downloadscp/upload")->withErrors($validator)->withInput();
}

No special configuration as far as I know.


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-27702221
.

from laravel-debugbar.

Xpam avatar Xpam commented on May 18, 2024

Yes, it seems that file is being passed back to the view because of ->withInput()
Only binary files fail. Text files are ok. I am checking now why exactly the validator fails in the first place.

edit: see next comment

from laravel-debugbar.

Xpam avatar Xpam commented on May 18, 2024

Ok, I changed the redirect to ->withInput(Input::except("file")); so now the file is not being passed back if validator fails.

But this does not seem to be the problem. The validator passes fine and all steps are completed, all info is in the database. Just the debugbar crashes, everything else is executing fine.

from laravel-debugbar.

barryvdh avatar barryvdh commented on May 18, 2024

Can you try disabling the data collectors in the debugbar config to see
what collector is causing trouble?
Op 4 nov. 2013 18:17 schreef "Eurobattle.net" [email protected]:

Ok, I changed the redirect to ->withInput(Input::except("file")); so now
the file is not being passed back if validator fails.

But this does not seem to be the problem. The validator passes fine and
all steps are completed, all info is in the database. Just the debugbar
crashes, everything else is executing fine.


Reply to this email directly or view it on GitHubhttps://github.com//issues/27#issuecomment-27703470
.

from laravel-debugbar.

Xpam avatar Xpam commented on May 18, 2024

It is the db collector.. and I know why. I am saving the files in LARGEBLOB field in database. This must be the problem.

from laravel-debugbar.

barryvdh avatar barryvdh commented on May 18, 2024

Ok, pushed a possible fix to php-debugbar upstream.

from laravel-debugbar.

barryvdh avatar barryvdh commented on May 18, 2024

Is merged, is this better?

from laravel-debugbar.

Xpam avatar Xpam commented on May 18, 2024

I will do some tests and report back.

from laravel-debugbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.