File Upload

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

File Upload

Hugo <Nabble>
How can we handle file upload with luan?
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
done in rev 496d61b1fb5a.  Here is how to use it:

upload.luan
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
Please add an input type="text" to your form and see if you can print the submitted value. Everything seems to arrive as binary content. This is what I get when I do a Luan.repr(Http.request.parts):
{
name={content=<couldn't repr: binary: 46382405>},
phone={content=<couldn't repr: binary: 2eb066a0>},
email={content=<couldn't repr: binary: 6d30f0c>},
file={filename="test.jpg", content_type="image/jpeg", content=<couldn't repr: binary: 5f38a856>}
}
How can I get the plain text information?
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
fixed in rev 0581238084ad
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
I removed Http.request.parts and now put everything in parameters in rev 9dbf3433f70f
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
It looks good, thanks.
Closing thread.
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
Fileupload is broken. This is what I get when I submit files:
{filename="robot.jpeg", content_type="image/jpeg"}
{filename="math21.jpg", content_type="image/jpeg"}
{filename="dead_sea1.jpg", content_type="image/jpeg"}
Where is the "content" binary value?
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
It should be there but doesn't show in repr().  I will fix this but it may take some time.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
fschmidt wrote
It should be there but doesn't show in repr().
It is not there. The file attachment complains exactly about that (no "content" available).
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
Hugo <Nabble> wrote
It is not there. The file attachment complains exactly about that (no "content" available).
This I can't reproduce with the current Luan.  We can discuss this.
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
You can reproduce this issue now. Back to you.
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
fixed as of rev d9df6d6cb927
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
Luanhost.com is down now. I tried to update the server but it doesn't compile. I think you have to update the JAR file in dropbox.

./src/luanhost/WebHandler.java:66: error: cannot find symbol
		LuanState luan = LuanState.newInstance();
		                          ^
  symbol:   method newInstance()
  location: class LuanState
./src/luanhost/WebHandler.java:77: error: cannot find symbol
		String password = (String)init.rawGet("password");
		                              ^
  symbol:   method rawGet(String)
  location: variable init of type LuanTable
2 errors
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

fschmidt
Administrator
I did a release and it works now.  But do you know why it went down?
Woe to those who call bad good and good bad -- Isaiah 5:20
Following the Old Testament, not evil modern culture
Reply | Threaded
Open this post in threaded view
|

Re: File Upload

Hugo <Nabble>
Thanks, I restarted the server and everything seems to be working fine now.
Closing thread.