![]() |
|
| |||||||
| Notices |
| mySQL & PHP Discussions, information and help with mySQL and PHP. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
|
Ok so all I want to do is be able to upload some information using an html form including some videos. (1 at a time in each upload) then strip the filename from c:\whatever\myvideo.fla to myvideo.fla and store and store all the info in my database minus the video which will be stored in a "videos" folder. The SQL stuff isn't the hard part but when using plain old HTML FORMs and POST (I included ENCTYPE="multipart/form-data" in the form tag) the script simple times out leaving me looking at a blank screen. Is there a better way of doing this without taking the expensive commercial route? P.S. I have no problems passing string info from html to php and uploading to the database. 2 problems are; 1. Uploading the videos successfully (2-3mb). 2. stripping the file name to just the file i.e. myvideo.fla Any help would be greatly appreciated. I'm so stumped!! Steve |
|
#2
| ||||
| ||||
|
1) If you don't have a PHP script to handle the upload it will still work (You should setup a script to alteast check if the file already exists and for file extension), but it won't check anything about the file, and it will be uploaded to the same folder at the html page used to upload it. As to why it is timing out it is most likely an issue with the server settings. I know I was working on a script for someone else and it was timing out on any file over the size of 7mb. 2) It should just be uploading the filename.extension, if for some reason when you upload a file it is giving you the full location on your local hard drive then you will need to rename the file once its uploaded. You can do something like $file = $_POST['filename']; $new_name = substr($file, strrpos($file, '/')+1, strlen($file)); rename($file, $new_name); Where $file is the name on the server (the one that contains the full local hd path), and $new_name is the filename.extension extracted from that path.
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#3
| ||||
| ||||
|
Use Advanced BlueVoda Form Processor . It will do excactly what you want. It will store the info in the database, it will upload the files in any folder you like (you name it) and it will strip ypur local hard disk path from the path name leaving only the actual filename.extension. We have not usually had timeouts, if not for very large files. It has been working with mp3's of 6 - 7 Mb, so i beleive that you will have no problem.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#4
| |||
| |||
|
Thanks for the mega quick replies!! And I will definitely be checking that script out Naval! I don't think the issue is with the server settings. I checked using phpinfo() a few days ago. max file size is 20mb, memory_limit is 40mb and timeouts were set nice and high. Strange as hell.. Oh and thanks for the procedure to strip the local name down to just the name and extension! I'll give this all a whirl and see how i get on. Steve |
|
#5
| |||
| |||
|
Ok I looked at ABVFP and it's just what i'm looking for in the long run or maybe just not what i was expecting or there's probably more of a 90% chance that I'm using it incorrectly! I realise I am maybe not giving the best description of what I need help with. Because my english is attrocious... despite being from the UK :) substr($file, strrpos($file, '/')+1, strlen($file)); answers one question. I tested it to see what the outcome would be and it's perfect for one of my problems. Has anyone got a simple script that I can include in my current php to correctly upload a video to my webserver which is being passed from an html form using POST? addTutorial.php will have a form of structure, 4 text inputs (no problem) and 2 file inputs. 1 is a small image about 30kb or so.. (no problem posting this!!) and the other a flash video of about 2-3mb. This does not require much validation as the person that will be using the form will have a certain amount of training by myself! Is there a simple function to complete this task? Or is it going to be complicated no matter what way I approach it? Thanks Steve |
|
#6
| ||||
| ||||
|
Heres a shortened down version of an upload script ive used in the past. Note: I made some changes, and i didnt test, it may need some debugging. PHP Code:
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#8
| ||||
| ||||
|
It might seem that i insist on using ABVFP, but i think you would save your self some time by doing so. ABVFP wil upload the file(s), it will send you the message, it will store the info in the database (not the files themselves, though it can be easily modified to also store the files), and will also provide several validations. Furthermore, your own work is limited to installing the script and setting up your form. I also don't understand what you mean by "or probably i'm using it incorrectly". And why should you use the "substr($file, strrpos($file, '/')+1, strlen($file))" ? ABVFP as well as Watdaflip's script, both use the file name without including the path, so there should be nothing to strip. Or maybe i have misread your post ?
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#9
| |||
| |||
|
Ok here's what I have... I haven't even tested it yet because I know it's full of bugs.. I'm useless at combining my scripts with someone elses! PHP Code: |
|
#11
| ||||
| ||||
|
only issue I see is at if($db_query) that line is checking if the query to add the information to the database worked give success message, otherwise delete the fail and give failure message. You don't have a query called $db_query, and also you query to add to the database is after both file uploads.
__________________ Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#12
| |||
| |||
|
Yeah I need to change those bits and pieces I know but all in all you think this should work? A few friends have suggested converting the video to a bit stream and storing the video directly in the database. Does anyone know much about this or does this sound like a bad idea? |
|
#13
| ||||
| ||||
|
You can do whatever you want: store the file in the database, or simply upload it, or both. It's up to you. As Watdaflip was saying, the only problem here is that you have this piece of code Quote:
which is not needed there. This should check the database updating and give an error message, but, where you have it, it is not only useless, but it will also cause a problem, as $db_query doesn't yet exist at that point.
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#14
| |||
| |||
|
All this help has been incredible! I wish I had of known about this place sooner. I haven't got it working yet altogether but I'm sure I can with all the info here. I have one final question (couldn't find an answer on php.net). How do I convert a video to a bitstream, how large is it gonna be and what format would I need to make the field in my table on the database to hold it? All help has been great here. If you ever need any flash help drop me an email!! =) Thanks Steve |