|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
is that using a database ..because i dont have access to one
|
|
#4
|
|||
|
|||
|
You do not need any database, plz see the changes
|
|
#5
|
|||
|
|||
|
so will this upload and display the picture?
|
|
#6
|
|||
|
|||
|
Yes. It will.
Why you are not trying? |
|
#7
|
|||
|
|||
|
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
|
|
#8
|
|||
|
|||
|
$file_dir = "tutorials/";
above the folder, where uploaded files(images or files) will go (modify folder name or path according to your need). |
|
#9
|
|||
|
|||
|
k
ill give it a try |
|
#10
|
|||
|
|||
|
How would you put a limit for the size on it?
|
|
#11
|
||||
|
||||
|
You can do that in your php.ini.
|
|
#12
|
||||
|
||||
|
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.
|
|
#13
|
|||
|
|||
|
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?
|
|
#14
|
||||
|
||||
|
See my last post. There's probably another way to do this, but I've never needed to.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > php upload |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|