Cancelled

PHP image upload help needed

Hi,

I need a very small help. NO high ballers please as this is a very very small job.

I don't need you to do anything, I just need you to tell me what to do and I will do it myself.

here is the exact details:

I have a PHP code that will allow me to upload images onto my server and it will renames the files so they won't overwrite each other.

I need to know how I can save the renamed files name on the mysql databse.

here is my PHP code:

<?php

function findexts ($filename)

{

$filename = strtolower($filename) ;

$exts = split("[/\\.]", $filename) ;

$n = count($exts)-1;

$exts = $exts[$n];

return $exts;

}

//This gets al=$_POST['vehichle'];l the other information from the form

$vehichle_name=$_POST['vehichle_name'];

$upload=($_FILES['uploaded']['name']);

$vehichle=$_POST['vehichle'];

$contact=$_POST['contact'];

// Connects to your Database

mysql_connect("localhost", "myUsername", "pass") or die(mysql_error()) ;

mysql_select_db("databaseName") or die(mysql_error()) ;

//This applies the function to our file

$ext = findexts ($_FILES['uploaded']['name']) ;

//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.

$ran = rand () ;

//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.

$ran2 = $ran.".";

//This assigns the subdirectory you want to save into... make sure it exists!

$target = "images22/";

//This combines the directory, the random file name, and the extension

$target = $target. $ran2.$ext;

if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))

{

echo "The file has been uploaded as ".$ran2.$ext;

}

else

{

echo "Sorry, there was a problem uploading your file.";

}

//Writes the information to the database

mysql_query("INSERT INTO `employees` VALUES ('$vehichle_name', '$vehichle', '$contact', '$upload')") ;

?>

at the moment the script above will upload the image and renames it and saves it in folder images22 successfuly.

i.e. Uploades [url removed, login to view] and gives it a random name like [url removed, login to view] and saves as as 234523123123.png. this is well and good but when I look into my databse it showes the image with its original name which is [url removed, login to view] instead of [url removed, login to view]!!

can someone please help me with this as I have been trying to do this for 2 days with no avail.

cheers

Skills: PHP

See more: php save as, php code contact, php image upload, timestamp, php function , php extension, image upload, how upload files, help name, help me name, ext, employees needed, die line, png save, php file upload form, small php script variable, split file php script, file split php script, can save code database, upload extension, insert variable, save upload, mysql else insert, php random file name, upload image server php

About the Employer:
( 7 reviews ) westcliff-on-sea, United Kingdom

Project ID: #1407821

30 freelancers are bidding on average $30 for this job

neoconcepts

i can send you correct code.

$30 USD in 0 days
(121 Reviews)
7.3
abstechnosoft

Hello Check PMB for answer:)

$30 USD in 0 days
(129 Reviews)
7.1
AlinGhinoiu

Hello ! I can modify your image uploading script to fit your needs. Please check my offer through the private message board. Thank you !

$30 USD in 0 days
(109 Reviews)
6.9
siddhu1986

Hi, understood your problem. Kindly check PMB.

$30 USD in 0 days
(130 Reviews)
6.5
MarcusPan

HAVE THE CORRECTED CODE READY, let me help You.

$30 USD in 0 days
(135 Reviews)
6.5
ProgPro117

Ready to start now! I can fix this in a minute. Please give me this project

$30 USD in 1 day
(32 Reviews)
6.0
hrarcon

I can do it.I will do it within min.. I have done the similar work.I can give you the code.

$30 USD in 0 days
(14 Reviews)
6.0
rakshit0

Hi ! Let's solve now ! :) Sent u the solution ! :)

$30 USD in 0 days
(45 Reviews)
5.9
webedict

HELLO SIR, READY TO START RIGHT [url removed, login to view] START AND FINISH IT ASAP. I HAVE 3 YEARS OF EXPERIENCE IN PHP, MYSQL, AJAX, JAVASCRIPT, XHTML. THANKS !!

$30 USD in 0 days
(57 Reviews)
5.2
bisaria

Hi Expet in PHP .We will do this in few [url removed, login to view] in PMB Thanxs Shilpa Pollux Technosoft

$30 USD in 0 days
(11 Reviews)
5.1
mehulsolanki

Hello sir, As this is very task, let me do it for you in within a miniut. Please chk pm

$30 USD in 0 days
(9 Reviews)
4.7
InovebTeam

I've fixed it. Please check PM. Thank you!

$30 USD in 0 days
(12 Reviews)
4.3
fensoft

This is very simple. I'm sorry I have to bid as high as $30 - your budget range won't allow a lower figure.

$30 USD in 0 days
(9 Reviews)
4.0
TayyabAlibin

found the problem just 5 mints fix...please give me a chance.

$30 USD in 0 days
(15 Reviews)
3.9
cicika

Check private messages.

$30 USD in 0 days
(4 Reviews)
3.9
dipsys

I can fix this right away.

$30 USD in 1 day
(18 Reviews)
3.8
bentaylor

Check you PMB. Thanks Ben

$30 USD in 0 days
(5 Reviews)
3.4
uniquecode1

Hi, Please see personal message. Thank you.

$30 USD in 0 days
(2 Reviews)
3.1
raovattaydo

Hello Please read more than private message thank you

$30 USD in 1 day
(4 Reviews)
3.0
ASTSBhopal

Hello, We can start immediately..Please check PMB Thanks ANK

$30 USD in 1 day
(2 Reviews)
2.4