PDA

View Full Version : 403 error



Gamer
11 Feb 2011, 6:24 AM
When I open the window I have this extension loaded into, in the chrome console I am getting a 403(forbidden) error on /image/thumbnail, any ideas why this would be. If you need more information or to view a test page let me know.
Thanks,
Gamer



Ext.ux.ImagePickerCombo = Ext.extend(Ext.ux.form.ComboBoxAdd, {
initComponent:function() {

Ext.apply(this, {
tpl: '<tpl for=".">'
+ '<div class="x-combo-list-item">'
+ '<div class="ext-ux-ImagePickerCombo-icon">'
+ '<img src="/billboards/uploads/image/thumbnail/{' + this.displayField + '}"/>'
+ '</div>'
+ '{' + this.displayField + '}'
+ '</div></tpl>',
minHeight: 250
});
Ext.ux.ImagePickerCombo.superclass.initComponent.call(this);
},

onRender:function(ct, position) {
Ext.ux.ImagePickerCombo.superclass.onRender.call(this, ct, position);
},

afterRender: function() {
Ext.ux.ImagePickerCombo.superclass.afterRender.call(this);

this.icon = Ext.DomHelper.append(this.wrap, {
tag: 'div',
cls: 'ext-ux-ImagePickerCombo-icon ext-ux-ImagePickerCombo-mainicon'
});
},

setIconCls:function() {

},

setValue: function(value) {
Ext.ux.ImagePickerCombo.superclass.setValue.call(this, value);
}
});
Ext.reg('imagepickercombo', Ext.ux.ImagePickerCombo);

arthurakay
11 Feb 2011, 9:06 AM
403 errors tell you that you (specifically the browser) does not have access to the file you're requesting. This is a server-side issue, having nothing to do with ExtJS or JavaScript.

- http://en.wikipedia.org/wiki/HTTP_403

Possible solutions include:
- authenticating the request (i.e. logging in)
- using POST instead of GET (depending on what the server expects)
- checking to see if your files/directory have the correct permissions to be accessed over HTTP

Gamer
11 Feb 2011, 10:30 AM
how can I change the extension so it does not look up a file if there is no filename?

arthurakay
11 Feb 2011, 12:33 PM
I'm not really familiar with how this extension works... but if I had to guess, you just need to add some logic to the XTemplate being used.

See the API Docs:
- http://dev.sencha.com/deploy/dev/docs/?class=Ext.XTemplate

My guess is that you simply need to add a conditional statement to the XTemplate. Something like:


Ext.apply(this, {
tpl: '<tpl for=".">'
+ '<div class="x-combo-list-item">'
+ '<div class="ext-ux-ImagePickerCombo-icon">'
+ '<tpl if="FILENAME !=\'\' ">'
+ '<img src="/billboards/uploads/image/thumbnail/{' + this.displayField + '}"/>'
+ '</tpl>'
+ '</div>'
+ '{' + this.displayField + '}'
+ '</div></tpl>',
minHeight: 250
});


As I mentioned before, I don't know much about this UX. You're going to have to replace FILENAME with the correct property... and perhaps alter the logic a bit. You get the idea.