Populate file list with previously uploaded files - fine-uploader

Using the jQuery wrapped version of Fineuploader v3.3.
Is it possible to populate the file list with files already in the upload folder?
I think "_addToList(id, name)" should do the trick, but I can't get it to work. Any ideas?

Seems that they are currently working on this feature:
https://github.com/Widen/fine-uploader/issues/784
So, this will be available soon.

This is not a behavior that Fine Uploader currently supports. Fine Uploader only displays files that users have submitted to the uploader since the current uploader instance was created. It doesn't try to be an all-in-one web application. You could probably add your own item to the list/UI via javascript. That probably wouldn't be terribly difficult, but seems like an odd thing to do.
If you'd like to discuss your specific use case more, please open up a feature request in the Github issue tracker.

Generally, client side code cannot add stored or hard-coded path based file names for use in any type of POST or upload operation. Obviously this is a security measure, you can imagine if a malicious web page could add to a generic POST operation some type of baked in file name. So from what I understand, only the user can specify path based file names, via a file browser for the session that it is included in. This applies to HTML/JavaScript/jQuery but am unsure if Flash/Silverlight based solutions would also be limited. I think a Java based uploader would be free of this. But you are just moving closer and closer to installed software.

Related

Include source code from different directory

I have three different domains all on the same server and I want to run the code on all three domains from one source on the same server, but not sure the best way.
Here's what I have:
domain01.com
domain02.com
domain03.com
domain04.com/sourcecode
I want domain01-03 to run the code inside domain04.com/sourcecode so the user can go to their domain and not have to go to domain04.com to see their site. I want to keep all the code inside domain04.com because I don't want to have to put the code inside each domain every time I make a code change.
For whatever reason I can't get my head around the best way to do this -- and want to do it right.
Any advice?
Thanks!
All you need to do is create a mapping on the first three sites to the appropriate directory in the fourth site, eg map /domain04 to /full/path/to/domain04/sourcecode, then refererence its CFML resources via /domain04 in CFC and include paths. The inference here is the code does need to be accessible via the file system for all sites concerned.
Note that if you also want to server non-CFML files via HTTP (eg: images, css, js), then you will also need a web server virtual directory along the same lines.
None of this requires a framework, it's standard CF / web server functionality.
Are you using a framework? One like ColdBox could make this trivial if your code is written modularly. (Disclaimer, I am affiliated with ColdBox)
If not, it really depends on what the code is. CFCs can be mapped anywhere via ColdFusion mappings. Even .cfm files can be included as long as the file systems are visible. If you're wanting to basically have complete copy of a site in another web root without duplication, I would first consider using a shared source control repo and a build process that checks it out in the appropriate places, and secondly a good old, symlink will also work .

Using Javascript to download file in Wicket

I am confused on how to do this.. Currently I am implementing an automatic download using Javascript:
target.appendJavaScript("location.href='"+ "./Access.xls" + "';");
This doesn't work.. What is the proper way to trigger an automatic download and how do I properly set the url? I am not too familiar with Javascript but trying to implement this. The file is in the root of the project.. but it tells me it is not found.
Also, when the user downloads it, I would like to then delete it right away after it is downloaded using Javascript, how can I do this? I am using Javascript because I am calling this file within an ajax method.
Thanks!
The best way to get access to that resource, you should use a ResourceReference as explained here. To get the url of a ResourceReference use:
RequestCycle#urlFor(ResourceReference, PageParameters)
However, I don't understand what you need regarding deletion of the file once downloaded. If your file is contained in the jar/war of your project, I don't believe it can be deleted from inside the web app. You could block access to it once it's downloaded however, if that makes sense. Not sure what you're trying to achieve here.

How can I set up custom ImageResizer urls?

I'm just getting started with ImageResizer and I'm stuck on what seem like totally basic questions:
I have an uploader that I use to put images into a directory that's not directly accessible over HTTP. (If I just put a image at, say, /images/myimage.jpg, then anyone could access it by just asking for it, whereas I want to limit access via thumbnails, watermarks, etc.). So I want to put it at /offlimits/myimage.jpg, but be able to serve it up at /public/images/myimage.jpg.
I don't really want to dump all the images in the same offlimits folder, because putting lots of files in one folder makes Windows unhappy. But I don't want to expose the details of that subdirectory structure either, so where do I put the mapping between the public facing url and the actual image location?
Most generally, I don't necessarily want an image extension at all, so I'd like to say /public/image_id?width=100... and have this map to /offlimits/sub1/sub2/sub3/image_id.jpg.
Can anyone advise about how to set this up?
Three part questions are generally frowned upon here at SO, but I'll bite anyhow :)
If you're allowing access to images based on authentication, then you need to use ASP.NET's URL Authorization feature. ImageResizer supports URL Authorization rules. If you just don't want the source files available, and want to force them resized or watermarked, read the docs on how to implement arbitrary rules like this.
You can rewrite image paths to your heart's content with Config.Current.Rewrite, which works just like the PostRewrite event mentioned earlier. Just remember you'll have to keep it all straight in your head later.
Image extensions are good things. Don't fight them. They let the server figure out the right mime-type to send and help errant browsers recover from related bugs. They prevent issues on several platforms and make the Save As dialog work. They significantly improve server efficiency as well, since handling logic doesn't have wait as long. This is particularly relevant because of the design of the IIS/ASP.NET modules system.

Better user agent library for Codeigniter

I am looking for a more advanced user agent detection library for Codeigniter.
I want to add short tags for OS, Browser and Browser version to the body tag so
that I am able to write CSS that is gear towards different browsers and platforms.
Like this:
<body id="Win7 IE9">
Right now the default agent detection library for CI produces this:
<body id="Windows 7 Internet Explorer 9.22.2">
How can I "shorten" the response?
This is want I am looking to achieve: http://www.contao.org/en/blog/forget-about-browser-hacks-in-contao-210.html
Thankful for all input!
I don't think that user agent library is bad. It just do what it is supposed to do.
Maybe you should build a small helper or extend the user agent library, this is really simple task (you should look at agent->browser(), agent->version, agent->platfrom() etc.)
Despite what Contao says, these are browser hacks. Better way is to build your style sheets and/or javascript the right way (without this type of hacks). I don't ever needed different stylesheets (or browser specific classes) for different browsers.
I see what you are trying to do. To get away with this using CodeIgniter you'll have to basically rewrite the user agent library to return your shorter user agent strings (its time consuming but not too difficult)(the four user agent arrays are in: system/libraries/user_agents.php).
Its been more than a year since this question was asked but i am sure it will help someone in future. User agents names are defined in ./application/config/user_agents.php file in an associative array format you can change the value of array with the one you want.
Note: Changing the value in config file will reflect in the entire application. If you want to change in a particular area of application i would suggest to create your own function.
Try this
$this->session->userdata['user_agent'];

Storage Options with Mozilla Addon-SDK

I am a newbie to Addon-SDK. I am making an Addon in which I log some information meant for manually viewing later on. I came across the
Simple-Storage API but as far as I could figure out, it saves the information internally in some format which can only be accessed via function calls i.e. "ss.storage.variable_name".
I was wondering if this information is accessible somehow from windows directory structure i.e. maybe from some file in the profile directory.
And secondly, is there any way to access the SQlite Database, or any third
party API?
(I don't know why but the cfx test for this API gives me errors, so not able
to use this).
You can try with localStorage of HTML5 via Javascript: http://www.w3schools.com/html/html5_webstorage.asp
And then with Store: https://developer.mozilla.org/es/docs/Storage

Resources