Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Trying to get a new contribution up


halltristan

Recommended Posts

This is a part of the script for a new contribution I'm working on. The contribution will allow you to let customers upload files with their order - I need this myself because I deal with custom products. Once the file is uploaded by the customer, the file is given an additional 4 digit random number so it will not conflict with other files possibly of the same name. The script below is what assigns the random numbers.

 

What I would like to do is make the file associated with the order.

Something like: [filename] _ [order #] _ [random #] . [file extension]

 

This would allow any uploaded files to be easily associated with each order. I don't know exactly how to do this part because I'm not too experienced with php yet. But if someone could help me I could get the rest finished and the new contribution listed.

 

 

<?php

$file_name = $HTTP_POST_FILES['ufile']['name'];

$random_digit=rand(0000,9999);

$new_file_name=$random_digit.$file_name;

$path= "uploads/".$new_file_name;

if($ufile !=none)

{

if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))

{

?>

<font color="00ff00"><center><br>

<?php

echo "*** File Successfully Uploaded ***";

}

else

{

?>

<font color="red"><center>

<?php

echo "Error";

}

}

?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...