We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36875
    • 5 Posts
    I am using the Register snippet. Since you can make a registration form that has (nearly) all the fields that are in the user_attributes table and the snippet will happily save those fields for you, I lazily assumed you could also do something like

    <input type="file" size="12" name="photo" id="photo" value="[[+photo]]" />


    and it would save the photo somewhere on the server and insert the path (or at least the title) of the photo in the database.

    However, I tried this and it doesn’t do anything. The database field for ’photo’ is empty. Am I crazy, or is this feature not implemented? If the latter, will this be implemented in a future release? Please...? kiss


    (MODx 2.1.0-pl Traditional, Ubuntu 10.10, Apache, 2.2, PHP 5.3, MySQL 5.1.49)
      • 10793
      • 0 Posts
      Hi DutchIris,

      the photo field should contain a url.
      I’m working on a user profile update page and I succeeded in showing the picture after putting a valid url in the photo field. What is still missing is the part that uploads the picture somewhere in the website.

      Just for your inspiration, here below you can find the html

      <h1>Profile</h1>
      
      <p><a href="[[~6]]">My Home Page</a></p>
      
      [[!UpdateProfile]]
      
      <div class="update-profile">
          <div class="updprof-error">[[+error.message]]</div>
          [[+login.update_success:if=`[[+login.update_success]]`:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]
       
          <form class="form" action="[[~[[*id]]]]" method="post">
              <input type="hidden" name="nospam:blank" value="" />
       
              <label for="photo">Photo URL
                  <span class="error">[[+error.photo]]</span>
              </label>
              <input type="text" name="photo" id="photo" value="[[+photo]]" />
              <img src="my-home-dir/assets/[[+photo]]" />
      
              <div class="form-buttons">
                  <input type="submit" name="login-updprof-btn" value="[[!%login.update_profile]]" />
              </div>
          </form>
      </div>


      Pls note that I uploaded manually the pictures in a template directory before running the code.

      Hope it is useful
      bye


        • 42146
        • 73 Posts
        ever figure out how to have a user upload a photo to user dir?