|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
handling file uploads w/ php
Hey,
I'm trying to upload files through a web browser using PHP, but I'm running into a little trouble. Here's the form: <form enctype="multipart/form-data" action="test.php?action=copy" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000"> <input type="hidden" name="action" value="copy"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> Here's the code to copy the file once it's uploaded: $dir = "/web/cemmel/public_html/DEV/images/"; copy ($userfile, $dir); Here's the output: Warning: Unable to create '/web/cemmel/public_html/DEV/images/': Is a directory in /web/cemmel/public_html/DEV/test.php on line 35 Any ideas? - Chawncey |
|
#2
|
|||
|
|||
|
Could you post the source to test.php? That's where the error is apparently.
|
|
#3
|
|||
|
|||
|
sure...
Here's the whole source to test.php:
<html> <head> <title>TEST</title> </head> <body> <?php if ($action == "upload") { ?> <form enctype="multipart/form-data" action="test.php?action=copy" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="1000"> <input type="hidden" name="action" value="copy"> Send this file: <input name="userfile" type="file"> <input type="submit" value="Send File"> </form> <?php } if ($action == "copy") { print "userfile: $userfile<br>"; print "userfile_name: $userfile_name<br>"; print "userfile_type: $userfile_type<br>"; print "userfile_size: $userfile_size<br>"; print "tmp_name: $tmp_name<br>"; $dir = "/web/cemmel/public_html/DEV/images/"; copy ($userfile, $dir); ?> <br> <a href="?action=upload">Another...</a> <?php } ?> </body> </html> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > handling file uploads w/ php |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|