groovygarden
Programmer
- Aug 23, 2001
- 63
Hi,
I'm trying to write code to let users upload a file to my server.
The form I use is like this:
I process the data like this:
Pretty basic, but I just wanted to see if it would work... it didn't! I get this error message when trying to process the form:
Any ideas as to what (probably really obvious thing) I'm doing wrong?
Thanks a lot
I'm trying to write code to let users upload a file to my server.
The form I use is like this:
Code:
<form enctype="multipart/form-data" action="/admin/preview.php" method="post" name="add">
<input name="MAX_FILE_SIZE" type="hidden" value="1000">
<P>Upload File<br>
<input name="testfile" type="file" size="40">
</P>
<input name="submit" type="submit" value="Submit">
</form>
I process the data like this:
Code:
if(!empty($testfile)) {
//copy the file to permanent location
copy($testfile, "\files\myfile.txt");
//destroy the file
unlink($testfile);
}
Pretty basic, but I just wanted to see if it would work... it didn't! I get this error message when trying to process the form:
Code:
Warning: Unable to open 'C:\PHP\uploadtemp\php26.tmp' for reading: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\admin\preview.php on line 14
Any ideas as to what (probably really obvious thing) I'm doing wrong?
Thanks a lot