close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

File Upload not working for dynamic UploadFolder name

Thread began 12/03/2019 11:51 am by lr_leal239405 | Last modified 12/03/2019 5:11 pm by Ray Borduin | 63 views | 15 replies |

lr_leal239405

File Upload not working for dynamic UploadFolder name

I have an issue with getting the file to upload once I change the Upload to a dynamic path.

from
'UploadFolder' => "../../eCart/images/",
to
'UploadFolder' => "".($WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."",

the url in the database field is is https://www.mywebsitename.com/eCart/images/

I've tried several ways but it will not upload the file, although it will update the name.

?

Sign in to reply to this post

Ray BorduinWebAssist

The folder path can't be a URL. It has to be a file path.

If it will always begin with: https://www.mywebsitename.com then you could probably use something like:

'UploadFolder' => "".str_replace("https://www.mywebsitename.com","../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."",

Sign in to reply to this post

lr_leal239405

I tried that (I see that should work theoritacally). I also tried (after changing in the db the prod_url to 'eCart/

'UploadFolder' => "../../" . $WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url") . "images/" ,

but no go until I remove the dynamic part, then it always works going to any folder.

Sign in to reply to this post

lr_leal239405

Here's the first 30 lines of code:

<?php require_once('../../Connections/convacc_cx.php'); ?>
<?php require_once('../../webassist/mysqli/rsobj.php'); ?>
<?php require_once("../../webassist/file_manipulation/helperphp.php"); ?>
<?php require_once('../../webassist/mysqli/queryobj.php'); ?>
<?php
$WADAcac_prod_subcategory_NEW_update = new WA_MySQLi_RS("WADAcac_prod_subcategory_NEW_update",$convacc_cx,1);
$WADAcac_prod_subcategory_NEW_update->setQuery("SELECT * FROM cac_prod_subcategory_NEW WHERE cac_prod_subcategory_NEW.prod_id = ?");
$WADAcac_prod_subcategory_NEW_update->bindParam("i", "".($_GET['prod_id']) ."", "-1"); //Paramprod_id
$WADAcac_prod_subcategory_NEW_update->execute();?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "".str_replace("https://converteraccessory.com","../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."images/",
'FileName' => "[FileName]",
'DefaultFileName' => "".($WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_img")) ."",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Update"]) || isset($_POST["Update_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "prod_img", "0", "", "true", $WA_UploadResult1_Params);
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

What is your form action set to?

Try adding this code right after the recordset code:

php:
<?php

if (isset($_POST["Update"])) {
  die(
"Prod URL:" str_replace("https://converteraccessory.com","../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."images/");
}
?>



That will let you see the value that is being set so you can adjust and correct it more easily.

Sign in to reply to this post

lr_leal239405

I got the correct path:

Prod URL:eCart/images/

My form is set as:

<form class="Basic_Default" id="Update_Basic_Default" name="Update_Basic_Default" method="post" action="" enctype="multipart/form-data">

Sign in to reply to this post

Ray BorduinWebAssist

I think the correct path should be: "../../eCart/images/"

Sign in to reply to this post

lr_leal239405

I was playing around with it the path in the db. My latest one is this but no go:

<?php
if (isset($_POST["Update"])) {
die("Prod URL:" . str_replace("https://converteraccessory.com","../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."images/");
}
?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "".str_replace("https://converteraccessory.com","/../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."images/",
'FileName' => "[FileName]",
'DefaultFileName' => "".($WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_img")) ."",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>

and the path in the db is set to:

https://converteraccessory.com/eCart/

It's returning:

Prod URL:https://converteraccessory.com/eCart/images/

should it be returning: ../../eCart/images/ ?

Sign in to reply to this post

Ray BorduinWebAssist

Maybe try:

die("Prod URL:" . str_replace("https://converteraccessory.com","../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url",false)) ."images/");

Sign in to reply to this post

lr_leal239405

yeah. that shows: Prod URL:../../eCart/images/

but still wont' load the image.



<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "".str_replace("https://converteraccessory.com","../..",$WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_url")) ."images/",
'FileName' => "[FileName]",
'DefaultFileName' => "".($WADAcac_prod_subcategory_NEW_update->getColumnVal("prod_img")) ."",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...