SunQuest
 
           General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old January 27th, 2003, 11:14 AM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
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.

Reply With Quote
  #2  
Old January 27th, 2003, 05:40 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
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!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Can't open uploaded file...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway