file uploading problem [solved]

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

nerrad
Posts: 7
Joined: 06 Mar 2008, 13:29

file uploading problem [solved]

Postby nerrad » 13 Mar 2008, 09:50

the system i used is SmartFoxServer 1.6.1 free edition with flex 3 sdk.

whenever i try to upload file by using

Code: Select all

 sfs.uploadFile(fileRef);

i received an warning on serverside which said
18:29:09.921 - [ WARNING ] > Invalid user upload from: 192.168.1.100


192.168.1.100 was my pc ip, my server and client both residing on the same pc. was this message triggered by security or invalid FileFeference?

i have tried imageManager tutorial it worked flawlessly, and i have read the tutorial 5 times, but i couldn't find a solution to this problem. i believe the problem is caused by my client wasn't setup correctly but i couldn't open the tutorial imagemanger.fla because i don't have flash 8 installed. could any help me please?
Last edited by nerrad on 17 Mar 2008, 13:57, edited 1 time in total.
User avatar
csharpjava
Posts: 16
Joined: 23 Feb 2008, 03:20

Postby csharpjava » 13 Mar 2008, 17:24

yes. i would try getting flash 8 and trying it again.
nerrad
Posts: 7
Joined: 06 Mar 2008, 13:29

Postby nerrad » 13 Mar 2008, 19:00

:shock: thanks anyway
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 14 Mar 2008, 09:57

There's no good reason why it should not work from Flex :)
Before uploading you should make sure that your client is joined in a room, is this happening?

In order to check the ImageManager example get a trial of Flash CS3 from Adobe's website
Lapo
--
gotoAndPlay()
...addicted to flash games
nerrad
Posts: 7
Joined: 06 Mar 2008, 13:29

Postby nerrad » 14 Mar 2008, 18:29

yes i'm 100% sure it was connected to a room, because i could get a file list from server.

i'm lucky enough to get a flash 8 trial version, but i have a hard time to compile or "publish" the imageManager tutorial, flex is so much easier :evil:

anyway, i would like to list down the way i did it in flex and hopefully somebody could spot the error for me

Server-side
===========
- do nothing

Client-side
===========
1) create a fileReference object
private var fileRef:FileReference = new FileReference;

2) register file uploading event handler
fileRef.addEventListener(Event.SELECT, selectHandler);
fileRef.addEventListener(Event.COMPLETE, completeHandler);

3) open file browser dialogbox
fileRef.browse(types);

4) upload the selected file
private function selectHandler(evt:Event):void {
sfs.uploadFile(fileRef);
}

5) display result after uploading
private function completeHandler(evt:Event):void {
mDebug.text = "done";
}

help me please and thanks in advance
nerrad
Posts: 7
Joined: 06 Mar 2008, 13:29

Postby nerrad » 15 Mar 2008, 06:09

i found the problem, it was caused by upload.py limit the filesize to 1mb.

while editing the upload.py file, i noticed the uploadPath (or uploadDir) can be changed too, but after restarting the server, getUploadPath() still return the the default path, is there a way to fix this?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Mar 2008, 10:08

You should change the self.uploadDir variable pointing it to another existing folder
Lapo

--

gotoAndPlay()

...addicted to flash games
nerrad
Posts: 7
Joined: 06 Mar 2008, 13:29

Postby nerrad » 16 Mar 2008, 01:03

yes, that was the variable i'd changed. my problem is, on client side the SmartFoxClient.getUploadPath() still return me the default upload path not the new one.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 17 Mar 2008, 07:17

getUploadPath() uses the default location established by SmartFoxServer.
If you want to use another location you should keep track of the new URL in your code.

Please, remember that if you want to access the uploaded files after they have been submitted they should be located in a folder that is "seen" by the web-server.

regards
Lapo

--

gotoAndPlay()

...addicted to flash games
nerrad
Posts: 7
Joined: 06 Mar 2008, 13:29

Postby nerrad » 17 Mar 2008, 13:56

:D thanks! i guess this is the only way to do it for now

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 49 guests