PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

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:
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  
Old November 26th, 2002, 01:57 AM
chawncey chawncey is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Clementon, NJ
Posts: 4 chawncey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to chawncey
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

Reply With Quote
  #2  
Old November 26th, 2002, 04:32 AM
Kanu Kanu is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 91 Kanu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Could you post the source to test.php? That's where the error is apparently.

Reply With Quote
  #3  
Old November 26th, 2002, 04:47 PM
chawncey chawncey is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: Clementon, NJ
Posts: 4 chawncey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to chawncey
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>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > handling file uploads w/ php


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 | 
  
 





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