PDA

View Full Version : Form Uploads?


Y-STU-K
07-11-2003, 02:30 PM
Is there anyone that can help me out here? I'm trying to upload a file to a PHP server so that i can open the file in my PHP scritp.

I'm trying to get a CSV file loaded (comma separated values) in my PHP script form an upload form, this file i process and generate some more files from its row.

The file generation works its just the form upload that doesn't can tell me how to do this?

Jeewhizz
07-11-2003, 03:53 PM
What code are you using?

Y-STU-K
07-11-2003, 06:38 PM
<form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF'] ?>" method="POST">
Server Address where asx files will be stored<br />
<input name="server" type="text" /><br />
<br />
File Path<br />
<input name="vids" type="file" /><br />
<br />
<input name="submit" type="submit" value="Create" />
</form>

theres the code but how do i catch the file in my PHP script? or where does PHP upload it to and how do u use it once its there?

ReadMe.txt
07-11-2003, 09:04 PM
this should tell you all you need to know:

http://www.php.net/manual/en/features.file-upload.php

Y-STU-K
07-14-2003, 03:17 PM
ok i've tried and i've tried and i've tried, i've even tried using PHP's code for uploading files

does it work ???? DOES IT HELL any ideas

I've set the necessary bits n pieces in the php.ini and my directories are not write protected so whats happening why isn't it working :(

I really really really need this to work, and my future really does depend on this working :(

Please help!! :) please :)

mordred
07-14-2003, 04:18 PM
Can you say what *exactly* does not work? Does the file not get copied to the correct location, or don't you get any data at all to the uploader script? What does var_dump($_FILES); tell you? Any specific error messages?

If you can give us more information we might be able to help. Just stating "it doesn't work, I tried as it was written" is as helpful as showing a picture to a blind. We can't guess what exactly you did try and code. ;)

Y-STU-K
07-14-2003, 04:32 PM
right then if i use var_dump($_FILES); i get string(0) "" (empty string)

if i use the script on the PHP site it always gives me the error possible file upload attack.

i have my php.ini setup correctly as far as i am aware.

file_uploads on
upload_tmp_dir c:\winnt\temp
upload_max_filesize 2M

and php is installed as a isapi module on apache 1.3.27

i get not files uploaded its as if the browser doesn't pass the file or totally ignores it or something. I'm using Mozilla1.4 and IE6sp1 for testing


sorry for the rant :) its just i've been trying this for 2 days solid now and its driving me up the wall.

My other problem is then getting to work on a server running IIS :S

mordred
07-14-2003, 07:13 PM
Originally posted by Y-STU-K
right then if i use var_dump($_FILES); i get string(0) "" (empty string)


That is bad, $_FILES should either contain information about the uploaded file, or an empty array. But not a string. Double-check that it's really not an array. Which PHP version are you running?

Y-STU-K
07-14-2003, 07:21 PM
erm sorry it was a string element of the array :) didn't make that clear and i'm programming with register_globals off :) and its PHP 4.3.1 i'm using.

Oh btw i have managed to work out why it wasn't working the MAX_FILE_SIZE set on the for was not set big enough, i didn't realise that the value had to be in bytes and i was using kilobytes :mad:

but its working now thnax for your time anyway :) i've been doing some testing and that was the problem afterall :(

I've decided to write a lengthy tutorial on file uploading and file handling so ppl don'r make the mistakes i've made.