close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Upload file permissions cannot be changed for thumbnail image on upload

Thread began 2/20/2011 12:41 pm by Thomas Hill | Last modified 3/01/2011 2:50 pm by Jason Byrnes | 1945 views | 12 replies |

Thomas Hill

Upload file permissions cannot be changed for thumbnail image on upload

Hi,

I've used the upload server behaviour in UE 4 to upload an image field and create a thumbnail but have been having difficulty with the file permissions.

I've followed the threads that explain to change the code from:
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "image_upload", "2", "[ExistingFileName]_[Increment]", "false", $WA_UploadResult1_Params);
}
?>

To:
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "image_upload", "2", "[ExistingFileName]_[Increment]", "false", $WA_UploadResult1_Params);
chmod($WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"], 0644);
}
?>

This works great and changes the permission for the first image but not the second thumbnail image.

For now, the work around I am using is to have two separate server behaviours and two upload file fields but I really do want to be able to do this as I have another page I wish to implement this on.

Hope you can help.

Sign in to reply to this post

Jason ByrnesWebAssist

change:

php:
chmod($WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"], 0644);



to:

php:
chmod($WA_DFP_UploadStatus["WA_UploadResult1"]["serverDirectory"]."".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"], 0644);

chmod($WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_2"]["serverDirectory"]."".$WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_2"]["serverFileName"], 0644);
Sign in to reply to this post

Thomas Hill

Thank you

Cheers dude!

Worked perfectly! :-)

Sign in to reply to this post

Jason ByrnesWebAssist

excellent, glad to hear it is working.

Sign in to reply to this post

Thomas Hill

Now get an error if user leaves upload field blank

I am now getting the following error if the user leaves the field blank on submitted the form (even if they is already an uploaded photo).

My guess is to populate a form element and use this as the default file part but I can't get it to work. Can you help please?

Warning: chmod() [function.chmod]: No such file or directory in /users/thomas740/www.thomash.co.uk/testing/users_Profile_edit.php on line 127

Warning: chmod() [function.chmod]: No such file or directory in /users/thomas740/www.thomash.co.uk/testing/users_Profile_edit.php on line 128

Warning: Cannot modify header information - headers already sent by (output started at /users/thomas740/www.thomash.co.uk/testing/users_Profile_edit.php:127) in /users/thomas740/www.thomash.co.uk/testing/users_Profile_edit.php on line 186

Sign in to reply to this post

Jason ByrnesWebAssist

send me a copy of your page so i can see what you have set up so far.

Sign in to reply to this post

Thomas Hill

Files

The user_profile_edit page includes the upload/edit info.

Attached Files
Archive.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you have set the default file options to use recordset values.


create hidden form elements and set the hidden form elements to use the recordset data as the initial value. Then in the default file section, use the hidden form elements.

Sign in to reply to this post

Thomas Hill

Still no good

I forgot to mention that I'd already tried it that way but still had the same error. However if I add the folder info before it then it works BUT this info is then stored in the database as folder/folder/filename.jpg

Naturally this won't then work when the user comes to change details and leaves the field blank a second time.

I've included the file for you to look at again.

Tom

Attached Files
Archive2.zip
Sign in to reply to this post

Jason ByrnesWebAssist

i'd need to see the file where you didn't include the folder names to tell why that was not working.

to remove the folder names from the current version, edit lines 104:

php:
'DefaultFileName' => "images/profile_images/".((isset($_POST["existing_image"]))?$_POST["existing_image"]:"")  ."",


and 114:

php:
'DefaultFileName' => "images/profile_images/".((isset($_POST["existing_thumb_image"]))?$_POST["existing_thumb_image"]:"")  ."",




to:
104:

php:
'DefaultFileName' => "".((isset($_POST["existing_image"]))?$_POST["existing_image"]:"")  ."",


and 114:

php:
'DefaultFileName' => "".((isset($_POST["existing_thumb_image"]))?$_POST["existing_thumb_image"]:"")  ."",
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...