473,385 Members | 1,642 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,385 software developers and data experts.

PHP Image Upload

Goodmorning everybody.

Im started using PHP yesterday and i was wondering if anybody has a fully non-bug example of a php upload script. I want to learn how to upload a image true PHP with the follow functions:

- Rename the file once uploaded (Like random name).
- 2,5 MB Max (I believe php is doing bytes so that will be 2500000)

Im sorry if this is the wrong forum, But i just want to learn

Thanks!
Mar 21 '07 #1
3 2346
code green
1,726 Expert 1GB
if you want to learn why are you asking for a functional fully debugged script? This is not the way it works on a forum. You make an attempt yourself then ask for assistance when you are struggling.
Anyway your request is rather vague. Upload from where to where?
Mar 21 '07 #2
Sorry, I did not know that, I will keep that in mind.

I had a script that just uploaded it to images/ but i doesnt have it anymore. Overwrote it with other sample's.
Mar 21 '07 #3
vssp
268 100+
this function copyes a file or folder, it needs another function (ls_a):
this works perfect.
////////////////////////////////////////////////////////
/// cp function/////////////////////////////////
////////////////////////////////////////////////////////
function cp($wf, $wto){ // it moves $wf to $wto
mkdir($wto,0777);
$arr=ls_a($wf);
foreach ($arr as $fn){
if($fn){
$fl="$wf/$fn";
$flto="$wto/$fn";
if(is_dir($fl)) cp($fl,$flto);
else copy($fl,$flto);
}
}
}
///////////////////////////////////////////////////
/// ls_a function////////////////////////
// This function lists a directory.
// ANd is needed for the cp function.
function ls_a($wh){
if ($handle = opendir($wh)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." ) {
if(!$files) $files="$file";
else $files="$file\n$files";
}
}
closedir($handle);
}
$arr=explode("\n",$files);
return $arr;
}
Mar 21 '07 #4

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

Similar topics

15
by: lawrence | last post by:
I've been using the following function (yes, it is inelegant, what can I say, I wrote it a long time ago) to upload images. Haven't had a problem with it for at least a year, and I don't recall...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
2
by: Gary \(Girish\) | last post by:
Hello: I am using SA-FileUp to enable members to upload their product images to my ISP sever. When member uploaded a new image file, the file name is replaced with the member ID and the old file...
0
by: doffer | last post by:
I want to make a portfoliosystem where user can register and get their own portfolio... I've started the developer work, but I'm stuck on the image upload part... I'm experiencing some problems...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
2
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it...
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
7
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir =...
1
by: sravani1 | last post by:
This code runs like when i submit the form it takes the image and displayed and top of the image a map will displayed. But actually i want that when i give the image it checks the location in the map...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.