Scan through a users directory on their PC to generate xml - php

I know asp/php are serverside etc..however...
I would like to ask a user to select a dir on their computers hard drive, and be able to generate an XML file based on files found in this directory. I would then save xml file to website .
For example directory has 3 files in it.
c:\music\mp3\
bob1.mp3
bob2.mp3
bob3.mps
My background is vbscript/classic asp. But am happy to do this in PHP. I was wondering if JavaScript/Ajax might be my friend ??
Im not sure where to start ??

No web technology is allowed raw access to the user hard drive. You either need a browser plugin (you can write one!) or some executable on the client.

Related

Can i preselect local path when saving a File?

Is there a possibility to preselect a local path when downloading a file via php script ?
What I mean is, if I download a file, the browser prompts a window to select download location, if there was no permanently path set. Since there are many OS out there with different fileroots which structure I don't know, I wanted to give the user of my webapplication the possibility to save the savepath to a database. And if he starts a export and file is getting downloaded that the path were the file goes is presetted. Is this possible ? Sorry for my english :D
I searched google without results... may im looking wrong ^^
It is not possible because of security issues. You cannot access users' filesystem via browser without their knowledge - A user has to pick a file/directory/path to save something by their own.

Prompt user to save file to a specific location

I'm creating a website that generates a text file. I would like for the user to save the file to a specific folder (it's a backup file for a video game).
Is it possible to change the default folder the file is saved to via PHP or HTML? C#, while not my first pick, would also be acceptable.
If I understand correctly, NO you cannot default to a location on the users computer. This is just a security piece that you cannot get around.
Try educating the user before they download. That's the best way.
No file download locations are handle at the browser level
You could probably package the text file in an installer / extractor that loads it to the location you want, but I don't think you want to go that far ^.^
You cannot prompt the user to save the file to a specific place on his/her computer, you can however save some stuff on the users pc by the use of Web Storage, that is a part of the HTML5 spec. You will not be able to control where it will be saved though.
It would not be a smart move to store backups for your game on the users pc, as it would open a endless world of cheating and hacking.

Moving files around in PHP (relating to uploading files)

I have a site that people upload large (2mb-3mb) files to, In large quantities. So I need to store them on an external drive (my drobo). How can I upload files to a folder on the server and then how can I write a php script that retrieves them and lets users download them.
Thanks,
Joey Sacchini
To do this, simply move your files into an accessible space.
http://php.net/manual/en/function.move-uploaded-file.php
Be sure to consider the implications of this though. Once you move an uploaded file to an open directory, anyone can access it. This is very dangerous. Imagine someone uploading a PHP script.
It is best to create a script that fetches files from a location not in the web root. At a basic level, you can store the file's properties, such as original name (you should rename them to something random on disk) and mimetype, to database. Then send the file to the client with readfile().
For downloading backups to your own personal hard drive, just use SFTP.
This is not a quick answer, you need to understand how to upload, retrieve, and save the file to the server; set write permissions for PHP and a few other things. I suggest you try these links to get you started fast:
http://www.w3schools.com/php/php_file_upload.asp
http://www.tizag.com/phpT/fileupload.php
Also visit the PHP reference manual for some great examples.
well u can keep the uploaded files outside of server directory. so if ur server root is /www/htdocs u can keep the files in say /uploaded. so use something like
move_uploaded_file($_FILES['file'],'/uploaded')
this way ur files will be inaccesible to the outside world

Video Uploading: recommended process?

Hey just a quick question for anyone who has done this. I want to create a video tube site. I have done file uploads before but was wondering if anyone could give me suggestions on what I am planning to do.
The way I am planning is to have a folder in my web directory and to upload videos into the folder after virus scanning and checking mime. The video will then be converted and compressed using FFMPEG into flv.
I will change the name and store the video reference id in mysql so the file name can be fetched and served.
I will serve the files using HTTP_Download to a flash player
$dl = new HTTP_Download();
$dl->setFile("$path");
$dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, "$path");
$dl->setContentType('video/flv');
$dl->send();
Anyone have any suggestions? Is it a good idea to put all videos in one directory?
You may want to consider a Java based uploader as PHP can run into timeout problems on large uploads.
Also do you FFMPEG processing as a CRON job not at upload as it takes a long time.
Look in something like Wowza Streaming Server to serve the videos. Allows streaming and everything is above the root. I name each video with a UID and send a parameter to the Flash video player to decide which one to play.
Where and how you store them will largely depend on how secure they need to be (i.e. should people be able to access the files in the directory directly? or should it be stored more securely than that?)
If direct access is fine, then putting them all in one folder is okay. If not, then you may want to obscure folder names, store them in a secure Database, or in a folder that is not accessible outside of the server.
Also, I'm hoping you're aware of the massive amounts of storage space and bandwidth such a service will consume? I hope you have a scaled solution ready to deploy if you're really serious about this..

Online Image Slideshow Question. File Access Problems

I have a flash .swf file that I embed on my webpage. On my server I have the .swf file and multiple image folders. I would like to load every file in one of those folders into the flash slideshow. How should I go about doing this? I tried used Air but it doesn't work on my system as an application so I doubt it will work online. Eventually I plan on making a menu where you can select different folders to display and since they are of different sizes, a foreach loop would be optimal. Keeping a txt file with the number of images is also possible if theres a way to read that in, but I would prefer the more dynamic approach. I am working towards using php for the website if that helps find a solution.
Thanks,
-Mike
Also my slideshow works great online currently but i have to hardcode in the number of files.
I would suggest to have a PHP script on your server that takes care of parsing those folders, and return the list of files to Flash (with a valid public URL).
Basically at your application startup, you would call the PHP script to retrieve the full list of file (XML is a good format to be returned, or AMF if you have a lot of folders/files).
After all you have to do is manipulate that data to load whatever folder/files the user is willing to see.
Just for your information, Flash doesn't have access to the Filesystem, so it's impossible to parse folders directly from Flash. (However It is possible with an Air Application)

Categories