nahsorhseda
Member
- Messages
- 116
- Reaction score
- 0
- Points
- 16
below i have a script which can be used to upload images ,but the problem is i want the files to be renamed
for ex:if i have a file called "ab cd.jpg" ,i want to rename it to "ab_cd.jpg" or abcd.jpg i just want the spaces to dissappear .......
iam learning php and iam testing/working on a image editing script thats why i want the files to be renamed
here is the script please change it and post ......i mean the whole script from<?php to ?> please dont write half the script n post ....coz iam just a beginner....ill also pay you 100-150 credits for the work
here is the script....
thnks in advance
for ex:if i have a file called "ab cd.jpg" ,i want to rename it to "ab_cd.jpg" or abcd.jpg i just want the spaces to dissappear .......
iam learning php and iam testing/working on a image editing script thats why i want the files to be renamed
here is the script please change it and post ......i mean the whole script from<?php to ?> please dont write half the script n post ....coz iam just a beginner....ill also pay you 100-150 credits for the work
here is the script....
PHP:
l;
<?php
if (($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/vnd.wap.wbmp")
|| ($_FILES["file"]["type"] == "image/bmp")
|| ($_FILES["file"]["type"] == "image/pjpeg")
&& ($_FILES["file"]["size"] < 200000000000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("./" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"./" . $_FILES["file"]["name"]);
echo "Stored in: " . "image editor/" . $_FILES["file"]["name"];
echo"<br/>";
}
}
}
else
{
echo "invalid file<br/>";
}
?>
thnks in advance