473,770 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Uploading photos........

9 New Member
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 3607
ronverdonk
4,258 Recognized Expert Specialist
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 New Member
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.
Jan 8 '07 #3
cheryl
9 New Member
bool move_uploaded_f ile ( 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 New Member
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]
Jan 11 '07 #5

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

Similar topics

6
4471
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 code samples? My two php books don't cover uploading photo's to a web site. Thanks...
3
2282
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 problems: http://www.steve5252.addr.com/
9
3335
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 handling, I thought of an FTP solution. Displaying a link to ftp://mydomain.com/mydirectory is easy but limited to browsers who can act as FTP clients, such as Internet Explorer. When looking at PHP's FTP functions and googling for web-based FTP
2
2222
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 intended to create a new directory under Photos such as "Relatives".
2
1412
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 action="add_photo_response.php"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr><td colspan="2" align="center" class="subHeaderClass">Add Photo</td></tr>
4
29853
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 DirectoryInfo("/Photos/"); if (!strFolder.Exists) { strFolder.Create(); }
2
1330
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 to reduce the database size, keep the output a standardised on screen and to reduce viewing/downloading times. Has anyone any ideas, examples or pointers to help me out on this one, as I am still learning. thanks mike
1
1883
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 this form: <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br />
1
1429
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 that the file is to big. TIA - Jeff.
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9906
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.