By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,441 Members | 1,766 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,441 IT Pros & Developers. It's quick & easy.

Uploading photos........

P: 9
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?
Jan 7 '07 #1
Share this Question
Share on Google+
4 Replies

Expert 2.5K+
P: 4,258
Depends on whether you want to write all upload code yourself or use a free class available at Have a look at the Upload class
This 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
Ronald :cool:
Jan 7 '07 #2

P: 71
Yes .....this is can start with php function

[PHP]bool move_uploaded_file ( 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_file() will return FALSE.
Jan 8 '07 #3

P: 9
bool move_uploaded_file ( string filename, string destination)

Where should i put this codes? can you recommend any website links that can help me with this problem?
Jan 11 '07 #4

P: 71
Sorry for late replly... i was busy.
try with this code.
[HTML]<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="post" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />

$target_path = "uploads/"; //Where the file is going to be placed

/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_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!";
Jan 11 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.