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:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old July 20th, 2003, 12:23 PM
Bruski Bruski is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192 Bruski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
php upload

does anyone know or can show me a simple php upload tutorial that uploads a picture and then displays it....ive looked top to bottom and side to side even tried making from other examples but cannot seem to find or make one... sorry if im asking too much .

thank you again...

bruski

Reply With Quote
  #2  
Old July 20th, 2003, 08:04 PM
iahmed iahmed is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: USA
Posts: 171 iahmed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 58 sec
Reputation Power: 6
Php script to upload files
==========================

<html>
<head>
<basefont face="Verdana" size="2">
</head>
<body background="asWeb/asbg.gif">
<center>
<font color=blue size=2>
<!-- <font face=verdana size=2 color =blue> Web Editor v 2.0</font> -->
<font face=verdana size=2 color =blue> Copy objects from local computer to remote server</font>


<?php
set_time_limit(600);

set_error_handler(0);

$numoffile = 10;
// Fix path of your file to be uploaded
$file_dir = "tutorials/"; // folder name for uploaded file
if ($_POST) {
for ($i=0;$i<$numoffile;$i++) {
if (trim($_FILES['myfiles']['name'][$i])!="") {
$newfile = $file_dir.$_FILES['myfiles']['name'][$i];
move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile);
$j++;
}
}
}
if (isset($j)&&$j>0) print "<br>Object(s) has been uploaded.<br>";
print "<form method='post' enctype='multipart/form-data'>";
for($i=0;$i<$numoffile;$i++) {
print "<input type='file' name='myfiles[]' size='30'><br>";
}
print "<br><input type='submit' name='action' value='Copy Files'>";
print "</form>";

?>
</font>
</body>
</html>

Last edited by iahmed : July 21st, 2003 at 08:58 AM.

Reply With Quote
  #3  
Old July 20th, 2003, 08:55 PM
Bruski Bruski is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192 Bruski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
is that using a database ..because i dont have access to one

Reply With Quote
  #4  
Old July 21st, 2003, 08:59 AM
iahmed iahmed is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: USA
Posts: 171 iahmed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 58 sec
Reputation Power: 6
You do not need any database, plz see the changes

Reply With Quote
  #5  
Old July 21st, 2003, 09:05 AM
Bruski Bruski is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192 Bruski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
so will this upload and display the picture?

Reply With Quote
  #6  
Old July 21st, 2003, 01:57 PM
iahmed iahmed is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: USA
Posts: 171 iahmed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 58 sec
Reputation Power: 6
Yes. It will.
Why you are not trying?

Reply With Quote
  #7  
Old July 21st, 2003, 02:53 PM
Bruski Bruski is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192 Bruski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
it says upload file or what ever so i pressed and it doesnt display anypicture how do i use that to diplay the picture i uploaded

Reply With Quote
  #8  
Old July 21st, 2003, 05:48 PM
iahmed iahmed is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: USA
Posts: 171 iahmed User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 58 sec
Reputation Power: 6
$file_dir = "tutorials/";

above the folder, where uploaded files(images or files) will go (modify folder name or path according to your need).

Reply With Quote
  #9  
Old July 21st, 2003, 06:35 PM
Bruski Bruski is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192 Bruski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
k
ill give it a try

Reply With Quote
  #10  
Old December 6th, 2003, 11:12 AM
Shawn05 Shawn05 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 Shawn05 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 37 sec
Reputation Power: 0
How would you put a limit for the size on it?

Reply With Quote
  #11  
Old December 8th, 2003, 07:14 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You can do that in your php.ini.

Reply With Quote
  #12  
Old December 8th, 2003, 07:14 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Of course you could also allow the file to be uploaded, execute filesize() on the uploaded file, and delete it and display an error if it's too large.

Reply With Quote
  #13  
Old December 8th, 2003, 07:57 AM
Shawn05 Shawn05 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 4 Shawn05 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 37 sec
Reputation Power: 0
Yes but I only want to limit this script. I have other things that upload and do not wish to limit theme. Is there some code that I could put in the script that will limit the size?

Reply With Quote
  #14  
Old December 8th, 2003, 11:19 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
See my last post. There's probably another way to do this, but I've never needed to.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > php upload


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 |