close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

UE File Upload overwite error

Thread began 3/31/2011 7:31 am by dave7882409982 | Last modified 4/04/2011 2:16 pm by Jason Byrnes | 889 views | 3 replies |

dave7882409982

UE File Upload overwite error

This could be on my part because I don't know a lot about php. I can upload a file just fine and name it to a session variable but if I do it again and want to overwrite it it creates a second file with the same extension. For example it will create two files:

picture1.jpg
picture1.jpg.jpg

Code:
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "images/attractions/",
'FileName' => "".$_SESSION['attractionpic'] ."",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "0",
'ResizeHeight' => "0",
'ResizeFillColor' => "" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "fileupload", "0", "", "false", $WA_UploadResult1_Params);
}
?>

Could somebody please help me as I don't want it to be named [FileName] but rather the session variable. Thanks in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

if you are cgoing to set the file name using a session:
'FileName' => "".$_SESSION['attractionpic'] ."",

make sure the name in the session does not include the extension.

other wise leave the ddefault:
'FileName' => "[FileName]",

if you leave the default as in the above example, you can select the option to rename the new file if it already exists, and the extension will handle the renaming for you.

Sign in to reply to this post

dave7882409982

The session variable doesn't contain the filename. I don't want the file to be named the same thing as the users computer's filename at all.

Sign in to reply to this post

Jason ByrnesWebAssist

the only time I have seen the double extension like you describe has been if the file name setting includes the file extension.

where is the value for the session variable being set?

add the following code to the page to display the session variables value:
<?php echo($_SESSION['attractionpic']); ?>

Sign in to reply to this post

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...