Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

file into an array


yesudo

Recommended Posts

Posted

I am trying to put a file into an array - file input by user:

 

echo "<td class=\"smallText\" align=\"center\"><input type=\"file\" size=\"20\" name=\"product_image[".$i."]\"></td>\n";

 

then later assigning the file to another variable for processing:

 

$file = $HTTP_POST_VARS['product_image'][$i];

 

But all that seems to come out of the array is the original file location path !!

 

Any ideas ???

 

Please and thanx.

Your online success is Paramount.

Posted

in the form i now have:

 

echo "<td class=\"smallText\" align=\"center\"><input type=\"file\" size=\"20\" name=\"userfile[]\"></td>\n";

and in the upload part of the file i have(which is part of the update db loop):

 

// IMAGE UPLOADER(Added by E Brosnan - Hostingoscommerce.com)
? ? ?
?$file = $HTTP_POST_FILES['userfiles']['tmp_name'][$i]; ? ? ?
? ? ? ? ? ? ? ? ? ? ? ?$uploaddir = DIR_FS_CATALOG . DIR_WS_IMAGES;

? ? ? ? ? ? ? ? ? ? ? if (($file == "none")||($file=="")) {
? ? ? ? ? ? ? ? ? ? ? $file_name = "";
? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? copy($file, $uploaddir.$file_name);
? ? ? ? ? ? ? ? ? ? unlink($file);
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? // END IMAGE UPLOADER(Added by E Brosnan - Hostingoscommerce.com)
$file_name = $HTTP_POST_FILES['userfiles']['name'][$i]; ?

 

the final line above is so that i can extract the file name to add it into the db.

Your online success is Paramount.

Posted

anyone ??

 

now i have:

 

// IMAGE UPLOADER(Added by E Brosnan - Hostingoscommerce.com)
? ? ?
?$file = $HTTP_POST_FILES['userfiles']['tmp_name'][$i]; ? ?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? $file_name = $HTTP_POST_FILES['userfiles']['name'][$i]; ? ?
? ? ? ? ? ? ? ? ? ? ? ?$uploaddir = DIR_FS_CATALOG . DIR_WS_IMAGES;

? ? ? ? ? ? ? ? ? ? ? if (($file == "none")||($file=="")) {
? ? ? ? ? ? ? ? ? ? ? $file_name = "";
? ? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? copy($file, $uploaddir.$file_name);
? ? ? ? ? ? ? ? ? ? unlink($file);
? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ? ? // END IMAGE UPLOADER(Added by E Brosnan - Hostingoscommerce.com)

 

and:

 

echo "<td class=\"smallText\" align=\"center\"><input type=\"file\" size=\"20\" name=\"userfile\"></td>\n";

 

but still not working.

Your online success is Paramount.

Archived

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

×
×
  • Create New...