We are asked to create a website that can upload photos....Our website administrator must upload photos. His upoloaded photos must reflect on the users interface.. I dont know where and how to start with this module. can you help me to find codes in uploading photos?
Uploading photos........
Collapse
X
-
Depends on whether you want to write all upload code yourself or use a free class available at phpclasses.org. Have a look at the Upload class
Ronald :cool:Originally posted by upload classThis class is meant to assist in the management of files uploaded via Web forms.
It provides means to copy the uploaded files a separate folder. If the files are images in the GIF, PNG or JPEG format, it may also generate thumbnails by rescaling the uploaded images.
a basic upload script.. You can also resize the uploaded image and create thumbnails with that image -
Yes .....this is simple..you can start with php function
[PHP]bool move_uploaded_f ile ( string filename, string destination)[/PHP]
This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.
If filename is not a valid upload file, then no action will occur, and move_uploaded_f ile() will return FALSE.Comment
-
Sorry for late replly... i was busy.
try with this code.
[HTML]<form enctype="multip art/form-data" action="upload. php" method="POST">
<input type="hidden" name="post" value="100000" />
Choose a file to upload: <input name="uploadedf ile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>[/HTML]
[PHP]/
$target_path = "uploads/"; //Where the file is going to be placed
/* Add the original filename to our target path.
Result is "uploads/filename.extens ion" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploade d_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
[/PHP]Comment
Comment