Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Upload #18

Closed
tpharaoh opened this issue Feb 17, 2016 · 17 comments
Closed

File Upload #18

tpharaoh opened this issue Feb 17, 2016 · 17 comments

Comments

@tpharaoh
Copy link

Uploading file I get:

FileNotFoundException in File.php line 37:
The file "/tmp/phpUu3Bhl" does not exist

Is that because I am using php artisan serve in development?

@ModestasV
Copy link
Contributor

Hello @tpharaoh ,

Could you tell what are you trying to do? Seems that this error is not from our package but rather from your configuration. If that's the case - we are unable to help you.

@tpharaoh
Copy link
Author

Simply put I used quick admin to make a file upload. Uploaded a CSV.

It is possible the error is because I am using php artisan serve, so then you are right it's not you.

@tpharaoh
Copy link
Author

I did some more testing... and I think it must be part of quick admin.
$this->saveFiles($request); this line works, but it returns the error I previously mentioned.

The file does save... but then stops

@tpharaoh
Copy link
Author

I know this is not the right way to code it, but in testing, I got it to work doing it this way:
` foreach ($request->all() as $key => $value) {
if ($request->hasFile($key)) {
$filename = time() . '-' . $request->file($key)->getClientOriginalName();
$request->file($key)->move(public_path('uploads'), $filename);
Filetypeagain::create([$key=>$filename]);

        }
    }
    return redirect()->route('admin.mynewpage.index');

`

@w00p
Copy link

w00p commented Feb 25, 2016

Hi,

I am getting the same error when i am trying to upload a picture or file, this is what is posts in my DB:
/tmp/phpX46XKV

All the files is correctly uploaded to /public/uploads/ and /public/uploads/thumb/

Its a brand new laravel installation, v5.2.21, and quickadmin.

@tpharaoh
Copy link
Author

The solution I posted worked for me

On Thursday, 25 February 2016, Kjetil Elde notifications@github.com wrote:

Hi,

I am getting the same error when i am trying to upload a picture or file,
this is what is posts in my DB:
/tmp/phpX46XKV

All the files is correctly uploaded to /public/uploads/ and
/public/uploads/thumb/

Its a brand new laravel installation, v5.2.21, and quickadmin.


Reply to this email directly or view it on GitHub
#18 (comment)
.

@w00p
Copy link

w00p commented Feb 25, 2016

In what file did you put the code?

@tpharaoh
Copy link
Author

I am not near my dev PC now, but I put it in the file you have in the "use" on top of the automatically generated CRUD controller.

@ModestasV
Copy link
Contributor

Will investigate this issue in few days

@ModestasV ModestasV reopened this Feb 25, 2016
@tomhatzer
Copy link
Contributor

@tpharaoh Can you please try and remove the lines 40 and 45 from the file src/Controllers/publish/FileUploadTrait.php and see, if you still receive the error?

$request->files->remove($key);
(src/Controllers/publish/FileUploadTrait.php - Line 40 + 45)

The uploaded file is getting moved a few lines before and isn't available at this line anymore. So it's throwing an error.

@tpharaoh
Copy link
Author

No, didn't seem to help for me.

I also tried removing the similar line on line 40.

I checked my other quick admin install where I have it working, and in that
one I specifically put the code in the Controller itself as so:

foreach ($request->all() as $key => $value) {
if ($request->hasFile($key)) {
$filename = time() . '-' . $request->file($key)->getClientOriginalName();
$request->file($key)->move(public_path('uploads'), $filename);
Controllername::create([$key=>$filename]);
}
}

@tomhatzer
Copy link
Contributor

Ok and you only get this error when uploading a CSV file, right?

@tpharaoh
Copy link
Author

no, also jpg

On 26 February 2016 at 21:34, Tom Hatzer notifications@github.com wrote:

Ok and you only get this error when uploading a CSV file, right?


Reply to this email directly or view it on GitHub
#18 (comment)
.

@tomhatzer
Copy link
Contributor

@tpharaoh what version of laravel are you using currently?

@tpharaoh
Copy link
Author

5.2.16

On 26 February 2016 at 21:44, Tom Hatzer notifications@github.com wrote:

@tpharaoh https://github.com/tpharaoh what version of laravel are you
using currently?


Reply to this email directly or view it on GitHub
#18 (comment)
.

@tomhatzer
Copy link
Contributor

Ok I think the problem is somewhere else... Based on this issue created at the laravel repo, it could be a laravel problem I think.

Have a look here: laravel/framework#12350

They tell them to upgrade laravel to a newer version. Could you try this too and see if it helps?

@tpharaoh
Copy link
Author

OK, I guess I follow up there....

Now I get the same error someone in that threat mentioned, that the saved
file is the /tmp/phpTzUONP name

But, I will follow that thread now looking...

On 26 February 2016 at 21:53, Tom Hatzer notifications@github.com wrote:

Ok I think the problem is somewhere else... Based on this issue created at
the laravel repo, it could be a laravel problem I think.

Have a look here: laravel/framework#12350
laravel/framework#12350

They tell them to upgrade laravel to a newer version. Could you try this
too and see if it helps?


Reply to this email directly or view it on GitHub
#18 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants