|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Can't open uploaded file...
Hi!
I'm having a terrible experience with upload files. I've read many articles showing how to upload files using PHP and MySQL. So here's my problem. The file I think it's rightly uploaded, because I can get the filesize, the filename but I can't open the file. Take a look: // If I use this, I get an error message saying that is an array $fp = fopen($myFile,"rb"); // If I use this, I get an error saying that could not find the file $fp = fopen($myFile_name, "rb"); I'm using Windows 2000 and I've tried to make this with Apache and IIS and with both I get the same message. So I tried to modify php.ini to another temp directory, and I still get the same errors. Then I looked and php.net website for a PHP variable for the Temp directory in the system, and even with this I get the same error. And I've tried move_uploaded_file(), copy()... and have the same problem. In the form, I've inserted the tag: enctype="multipart/form-data" correctly, inserted the MAX_FILE_SIZE tag too and the size of the files I want to upload are less than 200 Kb. Can anyone help me this?!
__________________
Regards, Ramiro Varandas Jr. |
|
#2
|
|||
|
|||
|
Solved
I solved the problem.
I was using globals Off and then using the command: import_request_variables("GP"); For automatic create the variables on the script as I read at php.net website. But this doesn't work for uploaded files, so when I tried to open the files with fread() I always got an error, because it changed the type of the variable of a FILE to an ARRAY. So, I first tested with globals set to On and it worked fine. But, as I need it with globals Off, I used: $_FILES["myFile"]["tmp_name"] to get the temporary name of the file at the server and I works 100% fine! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Can't open uploaded file... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|