close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

uploading to a directory depending user login

Thread began 11/16/2013 12:33 pm by balexander389215 | Last modified 12/02/2013 6:47 am by Jason Byrnes | 2825 views | 20 replies |

balexander389215

uploading to a directory depending user login

I have added a script to the Registration page that automatically creates a directory using the users login name. Is there any way to link this directory to file upload so that when a user logs in in and uploads files it will automatically go to their directory?

Sign in to reply to this post

Jason ByrnesWebAssist

save that name as a session variable, then bind the upload folder to the session variable.

Sign in to reply to this post

balexander389215

Thank you but I'm not sure I know what you mean or more specifically how to do that. How do I save the database field as a session variable and how would I use that in DFPro?

thanks for your continuing support.

Sign in to reply to this post

Jason ByrnesWebAssist

on the login page, open the server behaviors panel, and double click the security assist authenticate user behavior. go to the Session tab. Click the plus button and select the username column, this will save the username to a session.

on the page that you add the upload file behavior to, click the lightning bolt icon next to upload folder, and select the session created by the login page.

Sign in to reply to this post

balexander389215

Thank you for your help. It is almost but not quite working. On the site I have a directory named author, inside that directory is another directory, author_files. It is in this directory that a new directory is automatically created with new registration using the username as the directory name. I followed your suggestions and what now happens is that uploaded files are going the the first, author directory. As I said, almost there. Do you have any input on what I might be doing wrong?

Thanks

Brian

Attached Files
upload3.php
Sign in to reply to this post

Jason ByrnesWebAssist

you have a number of different upload behaviors on this page and they are all set incorrectly.

In the upload folder, click the lightning bolt, and select the username session variable, this will add the following code:


<?php echo $_SESSION['username']; ?>

assuming the session is named username, it may look slightly different if your session uses a different name.

preface the auther/auther_files directory in front of that:
author/author_files/<?php echo $_SESSION['username']; ?>

NOTE: on pages that use a session, you may need to add the following code at line 1:
<?php @session_start(); ?>

Sign in to reply to this post

balexander389215

The reason for all the different upload behaviors is I kept trying different things to get it to work.

I tried it again from scratch. Created the session ID named username on the login page. Then I created a new form uploader.php went through the file upload wizard and added directory path and session variable as above. All the files still go into the main author directory. I even added a username directory into the author directory but no luck. Then I realized I missed the session start on line one of the uploader.php file, added it, uploaded to the site and retried. Still no luck. Should the author/author_files directory be an absolute path, ie., home/author/... or something like that.

I also uploaded the helperphp.php file, are there any other files that should have been uploaded?

Thanks

Nope, I just tried changing the path to the absolute path and still the same results, the uploaded files go directly into the author directory. Perhaps what I want is not possible?

Attached Files
uploader.php
Sign in to reply to this post

Jason ByrnesWebAssist

The file you sent has a few probelms to it

of the 5 upload file behavior you have in place, only one of them has the upload folder set to the author/author_files folder. for testing it would be best to start with only one file upload in order to track the results.

you have a few file fields that use the same name. This is not valid. each form element must use a unique name.

the multiple upload behaviors and reusing the same name are going to cause skewed results.

Sign in to reply to this post

balexander389215

I started over with a simple form and only one upload field. The end result is the same, files are still only going into the author directory.

Attached Files
upload.php
Sign in to reply to this post

Jason ByrnesWebAssist

I'll need to troubleshoot directly, see the private message section.

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