PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old September 3rd, 2002, 12:09 PM
Jezzmin Jezzmin is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 14 Jezzmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
file-upload question

ok i use this code to save a picture submitted by a form...

now why doesnt it work?

php Code:
Original - php Code
  1.  
  2. <?php
  3. if($pic_form=="submit") {
  4.     $dest=fopen("images/testpic.jpg", w);
  5.     $src=fopen($pic, r);
  6.     while(!feof($src)) {
  7.         fputs($dest, fgets($src, 1024));
  8.     }
  9.     fclose($dest);
  10.     fclose($src);
  11.     echo "testpic: <img src="images/testpic.jpg">";
  12. }
  13.  
  14. ?>

Reply With Quote
  #2  
Old September 3rd, 2002, 03:04 PM
kvance kvance is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 kvance User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: file-upload question

You may want to look at
move_uploaded_file.
http://php.net/move_uploaded_file

Reply With Quote
  #3  
Old September 3rd, 2002, 03:54 PM
Nimco Nimco is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 132 Nimco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Nimco
RE: file-upload question

The way PHP works is that when you upload a file, it is uploaded to a temp directory. At the end of the script's execution, the file is deleted from the temp directory. Therefore you must move the file before the script finishes. As kvance said, you need to look at the move_uploaded_file() function to see how to do this.

Reply With Quote
  #4  
Old September 4th, 2002, 07:59 AM
Jezzmin Jezzmin is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 14 Jezzmin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: file-upload question

woot

thanks a lot...works fine - finally I can continue with my cms

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > file-upload question


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 2 hosted by Hostway