473,715 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload problem...

Hi,

I'm trying to add an simple upload applet to shopping cart script. My new
applet form sends all needed post fields ( quantity, product, etc... )
but the "file" post field is hardcoded in applet.
Shop script works with :
<input type="file" name="id[SourceFile_1]"/>
but not with applet's:
<input type="file" name="SourceFil e_1"/>
I just cannot figure out how to fix this :(
Could somebody please help me?

Thanks in advanced,

-Event

Upload function: (note: TEXT_PREFIX = SourceFile_ UPLOAD_PREFIX =
upload_
############### ############### ############### ############### ######

function actionUploadPho tos($goto, $parameters, $message=false) {
global $messageStack, $db;
if (isset($_POST['products_id']) && is_numeric($_PO ST['products_id'])) {
$the_list = '';
$adjust_max= 'false';
if (isset($_POST['id'])) {
foreach ($_POST['id'] as $key =$value) {
$check = zen_get_attribu tes_valid($_POS T['products_id'], $key,
$value);
if ($check == false) {
$the_list .= TEXT_ERROR_OPTI ON_FOR . '<span class="alertBla ck">'
.. zen_options_nam e($key) . '</span>' . TEXT_INVALID_SE LECTION . '<span
class="alertBla ck">' . (zen_values_nam e($value) == 'TEXT' ?
TEXT_INVALID_US ER_INPUT : zen_values_name ($value)) . '</span>' . '<br />';
}
}
}
$add_max = zen_get_product s_quantity_orde r_max($_POST['products_id']);
$cart_qty = $this->in_cart_mixed( $_POST['products_id']);
$new_qty = $_POST['cart_quantity'];
//echo 'I SEE actionUploadPho tos: ' . $_POST['products_id'] . '<br>';
$new_qty = $this->adjust_quantit y($new_qty, $_POST['products_id'],
'shopping_cart' );
if (($add_max == 1 and $cart_qty == 1)) {
// do not add
$new_qty = 0;
$adjust_max= 'true';
} else {
// adjust quantity if needed
if (($new_qty + $cart_qty $add_max) and $add_max != 0) {
$adjust_max= 'true';
$new_qty = $add_max - $cart_qty;
}
}
if ((zen_get_produ cts_quantity_or der_max($_POST['products_id']) == 1
and $this->in_cart_mixed( $_POST['products_id']) == 1)) {
} else {

if ($the_list != '') {
$messageStack->add('product_i nfo', ERROR_CORRECTIO NS_HEADING .
$the_list, 'caution');
} else {
$real_ids = isset($_POST['id']) ? $_POST['id'] : "";
if (isset($_GET['number_of_uplo ads']) &&
$_GET['number_of_uplo ads'] 0) {
/**
* Need the upload class for attribute type that allows uploads.
*
*/
include(DIR_WS_ CLASSES . 'upload2.php');
for ($i = 1, $n = $_GET['number_of_uplo ads']; $i <= $n; $i++) {
if
(zen_not_null($ _FILES['id']['tmp_name'][TEXT_PREFIX .
$_POST[UPLOAD_PREFIX . $i]]) and
($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX .
$i]] != 'none')) {
$products_optio ns_file = new upload('id');
$products_optio ns_file->set_destinatio n(DIR_FS_UPLOAD S);
$products_optio ns_file->set_output_mes sages('session' );
if ($products_opti ons_file->parse(TEXT_PRE FIX .
$_POST[UPLOAD_PREFIX . $i])) {
$products_image _extension =
substr($product s_options_file->filename,
strrpos($produc ts_options_file->filename, '.'));

if ($_SESSION['customer_id']) {
$db->Execute("inser t into " . TABLE_FILES_UPL OADED . "
(sesskey, customers_id, files_uploaded_ name) values('" . zen_session_id( ) .
"', '" . $_SESSION['customer_id'] . "', '" .
zen_db_input($p roducts_options _file->filename) . "')");
} else {
$db->Execute("inser t into " . TABLE_FILES_UPL OADED . "
(sesskey, files_uploaded_ name) values('" . zen_session_id( ) . "', '" .
zen_db_input($p roducts_options _file->filename) . "')");
}
$insert_id = $db->Insert_ID();
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] =
$insert_id . ". " . $products_optio ns_file->filename;
$products_optio ns_file->set_filename(" $insert_id" .
$products_image _extension);
if (!($products_op tions_file->save())) {
break;
}
} else {
break;
}
} else { // No file uploaded -- use previous value
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] =
$_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
}

$this->add_cart($_POS T['products_id'],
$this->get_quantity(z en_get_uprid($_ POST['products_id'],
$real_ids))+($n ew_qty), $real_ids);
// iii 030813 end of changes.
} // eof: set error message
} // eof: quantity maximum = 1

if ($adjust_max == 'true') {
$messageStack->add_session('s hopping_cart', ERROR_MAXIMUM_Q TY . '
B: - ' . zen_get_product s_name($_POST['products_id']), 'caution');
}
}
if ($the_list == '') {
if (DISPLAY_CART == 'false' && $_GET['main_page'] !=
FILENAME_SHOPPI NG_CART) {
$messageStack->add_session('h eader', SUCCESS_ADDED_T O_CART_PRODUCT,
'success');
}
zen_redirect(ze n_href_link($go to,
zen_get_all_get _params($parame ters)));
} else {
}
}

############### ############### ############### ############### ############### ############### ##########
in upload2.php ( parse function and save )

function parse($key = '') {
global $messageStack;

if (isset($_FILES[$this->file])) {
if (zen_not_null($ key)) {
$file = array('name' =$_FILES[$this->file]['name'][$key],
'type' =$_FILES[$this->file]['type'][$key],
'size' =$_FILES[$this->file]['size'][$key],
'tmp_name' =$_FILES['file']['tmp_name']);
} else {
$file = array('name' =$_FILES[$this->file]['name'],
'type' =$_FILES[$this->file]['type'],
'size' =$_FILES[$this->file]['size'],
'tmp_name' =$_FILES['file']['tmp_name']);
}
} elseif (isset($GLOBALS['HTTP_POST_FILE S'][$this->file])) {
global $HTTP_POST_FILE S;

$file = array('name' =$HTTP_POST_FIL ES[$this->file]['name'],
'type' =$HTTP_POST_FIL ES[$this->file]['type'],
'size' =$HTTP_POST_FIL ES[$this->file]['size'],
'tmp_name' =$HTTP_POST_FIL ES[$this->file]['tmp_name']);
} else {
$file = array('name' =(isset($GLOBAL S[$this->file . '_name']) ?
$GLOBALS[$this->file . '_name'] : ''),
'type' =(isset($GLOBAL S[$this->file . '_type']) ?
$GLOBALS[$this->file . '_type'] : ''),
'size' =(isset($GLOBAL S[$this->file . '_size']) ?
$GLOBALS[$this->file . '_size'] : ''),
'tmp_name' =(isset($GLOBAL S[$this->file]) ? $GLOBALS[$this->file] :
''));
}
if (!is_uploaded_f ile($_FILES['tmp_name'])) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', WARNING_NO_FILE _UPLOADED,
'warning');
} else {
$messageStack->add_session('u pload', WARNING_NO_FILE _UPLOADED,
'warning');
}
return false;
}

if ( zen_not_null($f ile['tmp_name']) && ($file['tmp_name'] != 'none') &&
is_uploaded_fil e($file['tmp_name']) ) {
if (zen_not_null($ file['size']) and ($file['size'] >
MAX_FILE_UPLOAD _SIZE)) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', ERROR_FILE_TOO_ BIG, 'error');
} else {
$messageStack->add_session('u pload', ERROR_FILE_TOO_ BIG, 'error');
}
return false;
}

if (sizeof($this->extensions) 0) {
if (!in_array(strt olower(substr($ file['name'],
strrpos($file['name'], '.')+1)), $this->extensions)) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', ERROR_FILETYPE_ NOT_ALLOWED
.. ' ' . UPLOAD_FILENAME _EXTENSIONS, 'error');
} else {
$messageStack->add_session('u pload', ERROR_FILETYPE_ NOT_ALLOWED
.. ' - ' . UPLOAD_FILENAME _EXTENSIONS, 'error');
}
return false;
}
}

$this->set_file($file );
$this->set_filename($ file['name']);
$this->set_tmp_filena me($file['tmp_name']);

return $this->check_destinat ion();
} else {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', WARNING_NO_FILE _UPLOADED,
'warning');
} else {
$messageStack->add_session('u pload', WARNING_NO_FILE _UPLOADED,
'warning');
}
return false;
}
}
function save() {
global $messageStack;

if (substr($this->destination, -1) != '/') $this->destination .= '/';

if (move_uploaded_ file($this->file['tmp_name'], $this->destination .
$this->filename)) {
$width = 100;
$height = 100;
list($width_ori g, $height_orig) = getimagesize($t his->destination .
$this->filename);

if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetrue color($width, $height);
$image = imagecreatefrom jpeg($this->destination . $this->filename);
imagecopyresamp led($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);
imagejpeg($imag e_p, $this->destination . '/th/'. $this->filename,
100);
chmod($this->destination . '/th/'. $this->filename,
$this->permissions) ;
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader',
SUCCESS_FILE_SA VED_SUCCESSFULL Y, 'success');
} else {
$messageStack->add_session('u pload',
SUCCESS_FILE_SA VED_SUCCESSFULL Y, 'success');
}

return true;
} else {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', ERROR_FILE_NOT_ SAVED, 'error');
} else {
$messageStack->add_session('u pload', ERROR_FILE_NOT_ SAVED, 'error');
}

return false;
}
}

function set_file($file) {
$this->file = $file;
}

function set_destination ($destination) {
$this->destination = $destination;
}

function set_permissions ($permissions) {
$this->permissions = octdec($permiss ions);
}

function set_filename($f ilename) {
$this->filename = $filename;
}

function set_tmp_filenam e($filename) {
$this->tmp_filename = $filename;
}

function set_extensions( $extensions) {
if (zen_not_null($ extensions)) {
if (is_array($exte nsions)) {
$this->extensions = $extensions;
} else {
$this->extensions = array($extensio ns);
}
} else {
$this->extensions = array();
}
}

function check_destinati on() {
global $messageStack;

if (!is_writeable( $this->destination) ) {
if (is_dir($this->destination) ) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader',
sprintf(ERROR_D ESTINATION_NOT_ WRITEABLE, $this->destination) , 'error');
} else {
$messageStack->add_session('u pload',
sprintf(ERROR_D ESTINATION_NOT_ WRITEABLE, $this->destination) , 'error');
}
} else {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader',
sprintf(ERROR_D ESTINATION_DOES _NOT_EXIST, $this->destination) , 'error');
} else {
$messageStack->add_session('u pload',
sprintf(ERROR_D ESTINATION_DOES _NOT_EXIST, $this->destination) , 'error');
}
}

return false;
} else {
return true;
}
}

function set_output_mess ages($location) {
switch ($location) {
case 'session':
$this->message_locati on = 'session';
break;
case 'direct':
default:
$this->message_locati on = 'direct';
break;
}
}
}



Jun 23 '07 #1
2 2157
Never mind,

I figured it out. I had to read my PHP-book and rewrite parse key function
:)

-Event
"Event Horizon" <ev***@porvoo24 .comkirjoitti
viestissä:Tr*** ***********@rea d3.inet.fi...
Hi,

I'm trying to add an simple upload applet to shopping cart script. My new
applet form sends all needed post fields ( quantity, product, etc... )
but the "file" post field is hardcoded in applet.
Shop script works with :
<input type="file" name="id[SourceFile_1]"/>
but not with applet's:
<input type="file" name="SourceFil e_1"/>
I just cannot figure out how to fix this :(
Could somebody please help me?

Thanks in advanced,

-Event

Upload function: (note: TEXT_PREFIX = SourceFile_ UPLOAD_PREFIX =
upload_
############### ############### ############### ############### ######

function actionUploadPho tos($goto, $parameters, $message=false) {
global $messageStack, $db;
if (isset($_POST['products_id']) && is_numeric($_PO ST['products_id']))
{
$the_list = '';
$adjust_max= 'false';
if (isset($_POST['id'])) {
foreach ($_POST['id'] as $key =$value) {
$check = zen_get_attribu tes_valid($_POS T['products_id'], $key,
$value);
if ($check == false) {
$the_list .= TEXT_ERROR_OPTI ON_FOR . '<span
class="alertBla ck">'
. zen_options_nam e($key) . '</span>' . TEXT_INVALID_SE LECTION . '<span
class="alertBla ck">' . (zen_values_nam e($value) == 'TEXT' ?
TEXT_INVALID_US ER_INPUT : zen_values_name ($value)) . '</span>' . '<br />';
}
}
}
$add_max =
zen_get_product s_quantity_orde r_max($_POST['products_id']);
$cart_qty = $this->in_cart_mixed( $_POST['products_id']);
$new_qty = $_POST['cart_quantity'];
//echo 'I SEE actionUploadPho tos: ' . $_POST['products_id'] . '<br>';
$new_qty = $this->adjust_quantit y($new_qty, $_POST['products_id'],
'shopping_cart' );
if (($add_max == 1 and $cart_qty == 1)) {
// do not add
$new_qty = 0;
$adjust_max= 'true';
} else {
// adjust quantity if needed
if (($new_qty + $cart_qty $add_max) and $add_max != 0) {
$adjust_max= 'true';
$new_qty = $add_max - $cart_qty;
}
}
if ((zen_get_produ cts_quantity_or der_max($_POST['products_id']) == 1
and $this->in_cart_mixed( $_POST['products_id']) == 1)) {
} else {

if ($the_list != '') {
$messageStack->add('product_i nfo', ERROR_CORRECTIO NS_HEADING .
$the_list, 'caution');
} else {
$real_ids = isset($_POST['id']) ? $_POST['id'] : "";
if (isset($_GET['number_of_uplo ads']) &&
$_GET['number_of_uplo ads'] 0) {
/**
* Need the upload class for attribute type that allows
uploads.
*
*/
include(DIR_WS_ CLASSES . 'upload2.php');
for ($i = 1, $n = $_GET['number_of_uplo ads']; $i <= $n; $i++) {
if
(zen_not_null($ _FILES['id']['tmp_name'][TEXT_PREFIX .
$_POST[UPLOAD_PREFIX . $i]]) and
($_FILES['id']['tmp_name'][TEXT_PREFIX . $_POST[UPLOAD_PREFIX .
$i]] != 'none')) {
$products_optio ns_file = new upload('id');
$products_optio ns_file->set_destinatio n(DIR_FS_UPLOAD S);
$products_optio ns_file->set_output_mes sages('session' );
if ($products_opti ons_file->parse(TEXT_PRE FIX .
$_POST[UPLOAD_PREFIX . $i])) {
$products_image _extension =
substr($product s_options_file->filename,
strrpos($produc ts_options_file->filename, '.'));

if ($_SESSION['customer_id']) {
$db->Execute("inser t into " . TABLE_FILES_UPL OADED . "
(sesskey, customers_id, files_uploaded_ name) values('" . zen_session_id( )
.
"', '" . $_SESSION['customer_id'] . "', '" .
zen_db_input($p roducts_options _file->filename) . "')");
} else {
$db->Execute("inser t into " . TABLE_FILES_UPL OADED . "
(sesskey, files_uploaded_ name) values('" . zen_session_id( ) . "', '" .
zen_db_input($p roducts_options _file->filename) . "')");
}
$insert_id = $db->Insert_ID();
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] =
$insert_id . ". " . $products_optio ns_file->filename;
$products_optio ns_file->set_filename(" $insert_id" .
$products_image _extension);
if (!($products_op tions_file->save())) {
break;
}
} else {
break;
}
} else { // No file uploaded -- use previous value
$real_ids[TEXT_PREFIX . $_POST[UPLOAD_PREFIX . $i]] =
$_POST[TEXT_PREFIX . UPLOAD_PREFIX . $i];
}
}
}

$this->add_cart($_POS T['products_id'],
$this->get_quantity(z en_get_uprid($_ POST['products_id'],
$real_ids))+($n ew_qty), $real_ids);
// iii 030813 end of changes.
} // eof: set error message
} // eof: quantity maximum = 1

if ($adjust_max == 'true') {
$messageStack->add_session('s hopping_cart', ERROR_MAXIMUM_Q TY . '
B: - ' . zen_get_product s_name($_POST['products_id']), 'caution');
}
}
if ($the_list == '') {
if (DISPLAY_CART == 'false' && $_GET['main_page'] !=
FILENAME_SHOPPI NG_CART) {
$messageStack->add_session('h eader', SUCCESS_ADDED_T O_CART_PRODUCT,
'success');
}
zen_redirect(ze n_href_link($go to,
zen_get_all_get _params($parame ters)));
} else {
}
}

############### ############### ############### ############### ############### ############### ##########
in upload2.php ( parse function and save )

function parse($key = '') {
global $messageStack;

if (isset($_FILES[$this->file])) {
if (zen_not_null($ key)) {
$file = array('name' =$_FILES[$this->file]['name'][$key],
'type' =$_FILES[$this->file]['type'][$key],
'size' =$_FILES[$this->file]['size'][$key],
'tmp_name' =$_FILES['file']['tmp_name']);
} else {
$file = array('name' =$_FILES[$this->file]['name'],
'type' =$_FILES[$this->file]['type'],
'size' =$_FILES[$this->file]['size'],
'tmp_name' =$_FILES['file']['tmp_name']);
}
} elseif (isset($GLOBALS['HTTP_POST_FILE S'][$this->file])) {
global $HTTP_POST_FILE S;

$file = array('name' =$HTTP_POST_FIL ES[$this->file]['name'],
'type' =$HTTP_POST_FIL ES[$this->file]['type'],
'size' =$HTTP_POST_FIL ES[$this->file]['size'],
'tmp_name' =$HTTP_POST_FIL ES[$this->file]['tmp_name']);
} else {
$file = array('name' =(isset($GLOBAL S[$this->file . '_name']) ?
$GLOBALS[$this->file . '_name'] : ''),
'type' =(isset($GLOBAL S[$this->file . '_type']) ?
$GLOBALS[$this->file . '_type'] : ''),
'size' =(isset($GLOBAL S[$this->file . '_size']) ?
$GLOBALS[$this->file . '_size'] : ''),
'tmp_name' =(isset($GLOBAL S[$this->file]) ? $GLOBALS[$this->file] :
''));
}
if (!is_uploaded_f ile($_FILES['tmp_name'])) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', WARNING_NO_FILE _UPLOADED,
'warning');
} else {
$messageStack->add_session('u pload', WARNING_NO_FILE _UPLOADED,
'warning');
}
return false;
}

if ( zen_not_null($f ile['tmp_name']) && ($file['tmp_name'] != 'none')
&&
is_uploaded_fil e($file['tmp_name']) ) {
if (zen_not_null($ file['size']) and ($file['size'] >
MAX_FILE_UPLOAD _SIZE)) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', ERROR_FILE_TOO_ BIG,
'error');
} else {
$messageStack->add_session('u pload', ERROR_FILE_TOO_ BIG,
'error');
}
return false;
}

if (sizeof($this->extensions) 0) {
if (!in_array(strt olower(substr($ file['name'],
strrpos($file['name'], '.')+1)), $this->extensions)) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', ERROR_FILETYPE_ NOT_ALLOWED
. ' ' . UPLOAD_FILENAME _EXTENSIONS, 'error');
} else {
$messageStack->add_session('u pload', ERROR_FILETYPE_ NOT_ALLOWED
. ' - ' . UPLOAD_FILENAME _EXTENSIONS, 'error');
}
return false;
}
}

$this->set_file($file );
$this->set_filename($ file['name']);
$this->set_tmp_filena me($file['tmp_name']);

return $this->check_destinat ion();
} else {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', WARNING_NO_FILE _UPLOADED,
'warning');
} else {
$messageStack->add_session('u pload', WARNING_NO_FILE _UPLOADED,
'warning');
}
return false;
}
}
function save() {
global $messageStack;

if (substr($this->destination, -1) != '/') $this->destination .= '/';

if (move_uploaded_ file($this->file['tmp_name'], $this->destination .
$this->filename)) {
$width = 100;
$height = 100;
list($width_ori g, $height_orig) = getimagesize($t his->destination
.
$this->filename);

if ($width && ($width_orig < $height_orig)) {
$width = ($height / $height_orig) * $width_orig;
} else {
$height = ($width / $width_orig) * $height_orig;
}
// Resample
$image_p = imagecreatetrue color($width, $height);
$image = imagecreatefrom jpeg($this->destination .
$this->filename);
imagecopyresamp led($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);
imagejpeg($imag e_p, $this->destination . '/th/'. $this->filename,
100);
chmod($this->destination . '/th/'. $this->filename,
$this->permissions) ;
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader',
SUCCESS_FILE_SA VED_SUCCESSFULL Y, 'success');
} else {
$messageStack->add_session('u pload',
SUCCESS_FILE_SA VED_SUCCESSFULL Y, 'success');
}

return true;
} else {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader', ERROR_FILE_NOT_ SAVED,
'error');
} else {
$messageStack->add_session('u pload', ERROR_FILE_NOT_ SAVED,
'error');
}

return false;
}
}

function set_file($file) {
$this->file = $file;
}

function set_destination ($destination) {
$this->destination = $destination;
}

function set_permissions ($permissions) {
$this->permissions = octdec($permiss ions);
}

function set_filename($f ilename) {
$this->filename = $filename;
}

function set_tmp_filenam e($filename) {
$this->tmp_filename = $filename;
}

function set_extensions( $extensions) {
if (zen_not_null($ extensions)) {
if (is_array($exte nsions)) {
$this->extensions = $extensions;
} else {
$this->extensions = array($extensio ns);
}
} else {
$this->extensions = array();
}
}

function check_destinati on() {
global $messageStack;

if (!is_writeable( $this->destination) ) {
if (is_dir($this->destination) ) {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader',
sprintf(ERROR_D ESTINATION_NOT_ WRITEABLE, $this->destination) , 'error');
} else {
$messageStack->add_session('u pload',
sprintf(ERROR_D ESTINATION_NOT_ WRITEABLE, $this->destination) , 'error');
}
} else {
if ($this->message_locati on == 'direct') {
$messageStack->add_session('h eader',
sprintf(ERROR_D ESTINATION_DOES _NOT_EXIST, $this->destination) , 'error');
} else {
$messageStack->add_session('u pload',
sprintf(ERROR_D ESTINATION_DOES _NOT_EXIST, $this->destination) , 'error');
}
}

return false;
} else {
return true;
}
}

function set_output_mess ages($location) {
switch ($location) {
case 'session':
$this->message_locati on = 'session';
break;
case 'direct':
default:
$this->message_locati on = 'direct';
break;
}
}
}



Jun 24 '07 #2
Event Horizon wrote:
Hi,

I'm trying to add an simple upload applet to shopping cart script. My new
applet form sends all needed post fields ( quantity, product, etc... )
but the "file" post field is hardcoded in applet.
Shop script works with :
<input type="file" name="id[SourceFile_1]"/>
but not with applet's:
<input type="file" name="SourceFil e_1"/>
I just cannot figure out how to fix this :(
Could somebody please help me?
Either fix the script or work around it :-)

something like
if($_FILES['SourceFile_1'])
{
$_FILES[id['SourceFile_1']]=$_FILES['SourceFile_1'];
}
Not the nicest solution however :-)

Arjen
Jun 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
12014
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 changing it anytime recently. Nevertheless, the script is suddenly dying on this line: if (copy($uploadedFile, $pathToImageFolder)){ This is the error I get:
3
11761
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 table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
4
2424
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data and images offline and then send them online... but i have a problem regarding the images i want it to be sent to the web site So i want if there is a possible way to fill data offline and
2
2879
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 is then overwrited. Here is the problem: Member can uploaded new image at "Upload page" BEFORE viewing the new image at the "Detail page" without any problem. However, when member 1st viewed the image at the "Detail page" and then upload the...
4
4485
by: Matt Jensen | last post by:
Howdy I've got a rather strange issue occuring. I used forms based .NET authentication, although I'm also setting some session variables when people login. However, I've found when people use one of my webform pages which includes a button that pops up a window where you can upload files, if you upload files in this popup window, it seems to somehow clear out all of the session variables and the users get logged out. However, if...
1
8450
by: Alex | last post by:
I am having issues with a script to upload files from a client to a webserver. The problem is not with the actual upload but with where it uploads. The whole process is supposed to create a folder (it does) then upload the file to that folder and this is where the problem comes in. The file is written to the parent directory, not the directory that was created for this user. Following is the code. <% strFTProotFolder =...
9
3831
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web site for a small club I belong to and one of the features I would like to include is the ability to allow users to upload image files. unfortunately the servers web root www folder only allows READ and EXECUTE permissions, which makes it...
6
3038
by: Vic Spainhower | last post by:
Hello, I am trying to do a FTP file upload which works fine on my localhost but on my ISP server it fails. I can't seem to find where I can go to find the specific cause of the failure. In both cases the file is being transmitted to the same FTP server and using the same PHP script so it shouldn't be a file size or login credentials problem. Could someone please help me out and give me some ideas what is wrong. I would really...
7
3189
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file" name="file_1" size=46 /><input type=submit /> so, after adding a few files, the input fields look like this:
2
3348
by: printline | last post by:
Hi' all I have a strange problem when uploading files from a form to my ftp site. Here is my code: <?php $myFile = $_FILES; // This will make an array out of the file information that was stored. $file = $myFile; //Converts the array into a new string containing the path name on the server where your file is. $myFileName = $_POST; //Retrieve file path and file name
0
9340
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9103
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6646
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5967
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4477
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3175
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2539
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2118
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.