Uploading images not authorized? 
Posted: 09 July 2008 06:52 PM   [ Ignore ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

Hi there!
I bought the User module yesterday aftter pulling my hair for days with the EE speciality templates, and so far it’s made my life waaay easier!

BUT

One problem still smile On my edit profile page, i can successfully change both standard and custom fields, but for some reason the photo and avatar uploads come with the “not authorised” error message.
I have checked and users are definitely allowed to do that, and it did work using the standard EE templates (probably the only thing that worked actually!).
Even as a superadmin i get the same error message…

I have also tried disabling secure forms and that didn’t resolve the problem…
I have multiple user:edit forms on the page but that doesn’t seem to be the issue either…

Any clue as to why it wouldn’t work?
Thanks in advance for your attention !

Stripped down code below:

{exp:user:edit return="/profile/edit" form_name="photo_form" form_id="photo_form"}


{if photo_filename
!=""}
  
<div class="center"><img src="{photo_url}{photo_filename}" border="0" width="{photo_width}" height="{photo_height}"  alt="My photo" /></div>
  <
div class="clear"></div>
  <
span class="margin_bottom_20" id='infophoto' style="display:none">&#8250; <a href="[removed]void();" onclick="toggle_visibility('photoupload','infophoto'); show_submit('uploadbtn');"><strong>Change your photo</strong>  
  
</a></span>
{if:else}
    
<img src="/gfx/profile_placeholder.jpg" height="164" width="230" alt="Upload a photo now"/>
  <
span class="margin_bottom_20" id='infophoto'  style="display:none">&#8250; <a href="[removed]void();" onclick="toggle_visibility('photoupload','infophoto') show_submit('uploadbtn');"><strong>Upload a photo now</strong></a></span>
{/if}
  
    
{if avatar_filename
!=""}
    
<img src="{avatar_url}{avatar_filename}" border="0" width="{avatar_width}" height="{avatar_height}" title="{lang:my_avatar}" alt="{lang:my_avatar}" />
    <
span class="margin_bottom_20" id='infoavatar' style="display:none">&#8250; <a href="[removed]void();" onclick="toggle_visibility('avatarupload','infoavatar')"><strong>Change avatar</strong></a></span>
  
{if:else}
    
<img src="/gfx/avatar_placeholder.jpg" height="36" width="36" alt="Upload an avatar now"/>
   <
span class="margin_bottom_20" id='infoavatar' style="display:none">&#8250; <a href="[removed]void();" onclick="toggle_visibility('avatarupload','infoavatar')"><strong>Choose avatar</strong></a></span>  
{/if}
  
  
  
<input type="file" name="photo_filename" size="20" class="input" style="margin:5px 3px 0 0" value="{photo_url}{photo_filename}"/>   
<
input type="file" name="avatar_filename" size="20" class="input" style="margin:5px 3px 0 0" value="{avatar_url}{avatar_filename}"/>    
<
input type='submit' class='submit' value='Upload' name="submit" style="margin:5px auto;"/>
  
{/exp:user:edit}

Profile
 
 
Posted: 10 July 2008 05:34 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

romain_nz,

Which version of ExpressionEngine are you using? smile

 Signature 
Profile
 
 
Posted: 10 July 2008 12:41 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

Hi there,
It is version 1.6.3 , Build:  20080421

Profile
 
 
Posted: 11 July 2008 05:29 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

What happens if you turn off XSS filtering? smile

CP Home › Admin › System Preferences › Security and Session Preferences

 Signature 
Profile
 
 
Posted: 11 July 2008 11:51 AM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

Nope, still doesn’t do the trick....

Also i have tried copying the sample from the documentation into a brand new template, and it still doesn’t work. Won’t let me upload images. So i guess it’s something in my settings, but i have tried all the obvious. And whatever it is doesn’t affect it when i go through the standard EE templates…

Any more suggestions ?

Profile
 
 
Posted: 12 July 2008 07:21 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Does turning off Secure Forms work either? smile

CP Home › Admin › System Preferences › Security and Session Preferences

 Signature 
Profile
 
 
Posted: 13 July 2008 09:41 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

Did that and stated so on first post… Any know interference with other modules, plugins etc… ? Is that a possibility?

Profile
 
 
Posted: 14 July 2008 06:07 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

romain_nz,

Can I have a look in your CP, or at least access to the form on the front end? smile

 Signature 
Profile
 
 
Posted: 14 July 2008 03:02 PM   [ Ignore ]   [ # 8 ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

Hi there.
Well, it’s slightly confidential and password protected, i will email you the details smile Thanks for taking the time to have a look at it.

Edit. I have emailed you the stuff. Not sure if it worked though, didn’t receive a copy of the email even though i asked to. Let me know if you got it !

Profile
 
 
Posted: 15 July 2008 12:32 PM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Romain,

You have a lot of Javascript on that page… I suspect that’s the issue…
Testing with IE7, I don’t even have the option to upload a Photo. The Avatar field comes up, but no “Submit” button.

That itself is obviously an issue…

Try setting up the form “cleanly” by itself and see if it works. Then, start “adding” to it wink

Other than that, those effects are really neat! LOL cheese wink

 Signature 
Profile
 
 
Posted: 15 July 2008 01:56 PM   [ Ignore ]   [ # 10 ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

Damn, you might be right. I thought that the same error occured when i did a very basic copy of the sample form, but it doesn’t.
I guess i’m going to have to strip down the [removed] <-- javascript

Everything seems to display fine in Ie6, ie7 and FF for me though.... as superadmin. And then i checked and i get the same problem as you when logged in as a member…
Woooo weirdness.
Well at least that gives me something to investigate.
Thanks for your help!

Profile
 
 
Posted: 15 July 2008 04:16 PM   [ Ignore ]   [ # 11 ]
Newbie
Rank
Total Posts:  8
Joined  2008-05-12

All fixed.
There was actually 2 problems, one javascript error that was blocking the whole thing, and also having multiple user:edit wraps within one page doesn’t seem to work… (even with different form names, different ids for submits etc...)
I can live with that.
Is that a know issue though, or should it in theory work?

Anyhow, thanks for pointing me in the right direction!

Profile
 
 
Posted: 16 July 2008 07:15 AM   [ Ignore ]   [ # 12 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18
romain_nz - 15 July 2008 04:16 PM

Is that a know issue though, or should it in theory work?

I think it should in theory work… it’s just that Javascript complicates things wink

 Signature 
Profile
 
 
   
 
 
‹‹ Checkboxes in User      Key URL structure ››