4 Replies Latest reply on May 20, 2009 2:50 AM by tdepalmas

    Image upload in a file and rename in the DB

    tdepalmas

      hi,

       

      I have a form where the user can change or add his avatar, i'd like to know what's the best way to allow image's upload (with a max size) and rename this image, something like ('username'.jpeg). this new image would replace the previous one. only one image per user. and if this user haven't upload image, a 'default.jpeg' would apear on his profile...

       

      Any good solution or help for this problem??

       

      Cheers

       

      Tim

        • 1. Re: Image upload in a file and rename in the DB
          DwFAQ Level 4

          Heya Tim,

           

          Use the renaming options available in upload file SB to rename file to 'username'.jpeg you can add in users' username by using a session variable in the renaming option of file upload SB.

           

          For the feature to show avatar if one is chosen vs. default if no image is uploaded simply create a conditional region that shows if record field is empty then show default image if DB table column has image then show image. Using a conditional region to accomplish this is easy and straight forward.

          1 person found this helpful
          • 2. Re: Image upload in a file and rename in the DB
            tdepalmas Level 1

            Hi, thanxs for your answer, i think it's ok for the default photo when the user don't upload any photo, i've set a default value in my DB.

             

            But i didn't understand what you've wrote about the "SB".. is there a preset fonction to upload files on my website in DW ?

             

            Cheers

            Tim

            • 3. Re: Image upload in a file and rename in the DB
              DwFAQ Level 4

              i didn't understand what you've wrote about the "SB".. is there a preset fonction to upload files on my website in DW ?

               

               

               

              Using Adobe Dreamweaver Developers Toolbox (ADDT - the forum you are posting in) there is a file upload SB (acronym for server behavior) located in Server behavior/Developers Toolbox/File Upload. If you do not have ADDT you do not have this server behavior and you are posting in the wrong forum. Although doubtful you might get a better answer if you don't have ADDT by posting in the Dreamweaver Application Development forum

              • 4. Re: Image upload in a file and rename in the DB
                tdepalmas Level 1

                Oki, i might post in the wrong forum. i'll try in another one.

                 

                Thanks for you aswer.

                 

                Cheers

                 

                Tim