Viper114 Posted October 12, 2010 Share Posted October 12, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/215720-php-uploads-failing/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 12, 2010 Share Posted October 12, 2010 the page reports that it's failing to receive the upload entirely It would help to know what that code is and the exact error message. Quote Link to comment https://forums.phpfreaks.com/topic/215720-php-uploads-failing/#findComment-1121537 Share on other sites More sharing options...
Viper114 Posted October 12, 2010 Author Share Posted October 12, 2010 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{ Quote Link to comment https://forums.phpfreaks.com/topic/215720-php-uploads-failing/#findComment-1121542 Share on other sites More sharing options...
PFMaBiSmAd Posted October 12, 2010 Share Posted October 12, 2010 $HTTP_POST_FILES was depreciated a really long time ago (php 4.1, Dec. 2001), turned off by default in php5, and to be removed in the next major php revision. The code should be using $_FILES instead of $HTTP_POST_FILES Quote Link to comment https://forums.phpfreaks.com/topic/215720-php-uploads-failing/#findComment-1121564 Share on other sites More sharing options...
Viper114 Posted October 12, 2010 Author Share Posted October 12, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/215720-php-uploads-failing/#findComment-1121568 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.