473,396 Members | 1,971 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Uploading photos........

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
4 3588
ronverdonk
4,258 Expert 4TB
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
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
kamill
71
Yes .....this is simple..you 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
cheryl
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
kamill
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" />
</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.extension" */
$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_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!";
}
[/PHP]
Jan 11 '07 #5

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

Similar topics

6
by: Ralph Freshour | last post by:
I'm trying to code the ability for my users to upload up to photo's to mysql database - can someone point me in the right direction as to how this might be done in php? Perhaps a tutorial or some...
3
by: Jeff Alu | last post by:
Hi, I'm moving a website to a new location for a friend of mine. The old site http://www.infomercialavails.com Is working fine. However, the php files at the new location seem to be having...
9
by: Markus Ernst | last post by:
Hi For a CMS admin tool I would like to provide a possibility to upload large files to a directory on the webserver. As HTTP uploads are limited in file size and also not comfortable in...
2
by: Ross | last post by:
Hi I have an application using asp.net that I am running on my PC. The web form has a text box where you can enter a name for a new Photo category then click on the button. The code is...
2
by: laredotornado | last post by:
Hi, I'm using PHP 4 and trying to upload an image. I think I'm using the right "enctype". Here is the form I submit <form name=addPhotoForm enctype="multipart/form-data" method=post...
4
by: Mukesh | last post by:
Hi all I am trying to upload and save as a picture to "root/Photos" folder in my web application. I am using this code to perform this task DirectoryInfo strFolder = new...
2
by: mike_ni | last post by:
im designing a site (still in my head at the moment) where users will be able to upload photos but I would like somewhere in the upload process, for these photos to be resized down to e.g 600 x 400...
1
by: recordlovelife | last post by:
Hi all. I need to make a file uploader, so a client can upload pictures to a directory on their shared server, so that they can later include the photos in news updates. I simply want to take...
1
by: Mufasa | last post by:
Is there any way with the fileupload control to not have it upload the file if it's to big? I want to set a 5MB limit but don't want to have the user upload a 50MB only to be told once it's done...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.