![]() |
Aptana Jaxer and file uploads
Hey guys. I need an advice about some paths. Well, I developed a file manager (let's say it's something like the Windows Explorer - a simple system navigator) using Aptana's Jaxer. Now, in Javascript I only have the filesystem paths (on windows they will be like C:/dir/file.jpg, for example). How would I upload these paths using only Javascript and PHP (if possible)? I've tried this, so far:
1. create a hidden form, with a file input inside it. The idea was to populate the file input with one path at a time, and then submit the form inside an iframe or something like that (so I would also get a response from the server). That didn't work, as the file type inputs are read-only. I also tried using a file input and a hidden input with the same name, but that didn't work either. 2. use Jaxer's file management functions (tried to read a local file into a buffer and send pieces to the server to rebuild the file). The only problem is that I receive an error when reading from a non-text file (a JPEG, for instance), where the contents are not in utf-8 encoding. So this won't work, either. A solution would be to use an additional SWF file for the communication between javascript and PHP, therefore getting the ability to build a progress bar, aswell. But, I can do that from Javascript too, if just I could read the file somehow... LE: by 'uploading the paths' I mean uploading the files on the local filesystem with that specific path. |
Xenon,
Quick Introduction, I'm Davey and work @ aptana on Jaxer, and would be happy to help you get your project moving forward. I dont quite follow your description of what you are trying to do. But at least one thing jumped out at me which was that you are trying to read binary files with Jaxer, the API for that is slightly different from the regular files, when you open the file using the open method on a file instance, you should provide the open mode parameter for binary access which is 'rb' the code would like some thing like. Code:
var f = new Jaxer.File(myPath);We have Jaxer forums you can post questions and observation to ( Aptana Forums :: Jaxer ) let me know if you need more help. cheers davey |
Hello Davey. What I'm trying to do is upload an image/mp3/video file to a server using Jaxer's file wrapper and some server-side language.
About your suggestion...I do know the file modes and how/when to use them. The only problem is that Jaxer's File readAllLines() method throws an error if trying to read a whole file's contents: Code:
13:17:02 06/06/2008 [ 2080] [ERROR] [JS Framework] [framework.onCallback] message: -----======[ jsLib ERROR ]=====----- |
| All times are GMT. The time now is 08:51 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0