Jump to content

PHP Uploads Failing


Viper114

Recommended Posts

I'm now having a problem with PHP uploads on the test site I'm working on.  There is a special page called "cart_import.php" that directs CSV files selected for uploading to the "files" directory in the same location as the the page mentioned, and from there works on updating the website's front end with the data in the CSV file.  But, when I try and upload the file, the page reports that it's failing to receive the upload entirely.  I've confirmed with the host that the php.ini file does allow uploads, the "files" directory is set to write access and upload size allowed is a little over 2MB.  Is there perhaps another thing I'm missing to allow uploads, something that I haven't found yet with Google?

Link to comment
Share on other sites

Oops, sorry, forgot about that.  Originally, without any error tracking showing, it just reports back saying "Upload failed, file not received! ".  When I turned on error tracking, it gives a more specific detail:

 

Notice: Undefined variable: HTTP_POST_FILES in D:\wwwroot\blah.com\_root\cart_admin\cart_import.php on line 28

 

Taking a little snippet of coding in the area mentioned:

 

if ($action=="upload")

{

if (is_null($HTTP_POST_FILES['upload_file']['size']))

{

print "Upload failed, file not received!";

}else{

Link to comment
Share on other sites

I think I may have found something else.  When sifting through the errors, I found this:

 

Warning: fopen(.//files/) [function.fopen]: failed to open stream: No such file or directory in D:\wwwroot\blah.com\_root\cart_admin\cart_import.php on line 93

Path Failed to Open

 

The line in question is:

if ($fh=fopen("./$dirpath$newfile",'r'))

 

So, instead, maybe it's not pointing to the right path (there's no such thing as .//files/ anywhere), and therefore the files can't go somewhere that doesn't exist.  Unfortunately, if I try and manipulate things to see if it can find the proper path, it still says the path failed to open.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.