![]() |
|
| |||||||
| Notices |
| Forms Discussion and help related to designing and implementing forms in the BlueVoda Website Builder. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| ||||
| ||||
| The following tutorial will show you how to accomplish file uploads. However, since September 2006, the new Advanced BlueVoda Form Processor will do the same and much more. So please have a look at that also. And, since Jan 2007, ABVFP will also attach the files to the email that you receive with th erest of the form info. Please also note that since summer 2008 BlueVoda's embedded Form processor, also has the ability to upload files to the server, and it will include the link to download the files, in the mail that you receive with the rest of the form info. This tutorial is going to show you how to upload a file on your site using a form made in BlueVoda and a php script. We assume that you are familiar with the basics about creating a form in BlueVoda, as well as with the basic php script provided there. If you are not, please read first the BlueVoda Form Tutorial 1 The below is an example of PHP script you may use for processing your forms data and uploading single files.. Please follow the instructions that follow to the letter. Please note that this is only an example script, that can be customized to better suit your needs. Let’s start by explaining what we will do:
Let’s start by creating a form. It will have some contact information, as well as an upload field. It will look like the following image: Please note that, in order to have the form work with the script as it is, the email field MUST be called “email” and the upload field MUST be called “upload”. It is also advisable that you name your Submit button "submit", all lowercase letters, as we have implemented three lines of code that will take care NOT TO INCLUDE the Submit button title and value, but this code will only work if the button is named "submit". Set the form properties in: Form name: Uploadform Action: uploadaction.php Method: POST Encoding Type: multipart/formdata As shown in the following image: Now, let’s create the php script that will do the work. Please copy the following code: Quote:
Open Notepad. Paste the above code. Now, change the above four parts in Blue with your actual values: 1000000 is the limit file size, in bytes ( 1 Mb = 1000000 bytes). You can set it to be whatever you want. http://www.yourdomain.com/uploads is yourdomain name and folder (uploads) where the file will be uploaded. Please do not change the "uploads" part, as you would also need to modify the script. Enter Your Subject Here : this is the email subject, change it to whatever you want. Values submitted from web site form : : is the first line of your email. Change it to whatever you like. Once you are done with the changes, click on File, Save As, select File Type : All files, and save the script on your computer as “uploadaction.php” Now lets create the Thankyou page. It will be a simple BV page, and will look like the following: Make sure to put your menubar in this page, so the visitors can go on navigating your site. Ok, we now need the error page: We will also create it in BV, and it will look as follows: Make sure to
Name: optional, “Back” Value: optional, “Back” Button Type: “On Click” OnClick Action: “Go to the previous Page” just like in the image below: If you wish you can also change the button style, but this goes beyond this tutorial purposes. So, now you have the following BV pages:
Open BlueFTP, connect, and UPLOAD the “uploadaction.php” file that you created in Notepad, in public_html also. There is ONE LAST STEP: you need to create the “uploads” folder, for the files to be uploaded. So while you are in BlueFTP, click anywhere on the right window (the one with your site content). Now click on File, New Folder, and create this new folder named “uploads”. If you name it anything else, you will need to change the script accordingly. Now right click your new created folder, and set the permissions to 777. Congratulations! You are done. Test your form. Troobleshooting: If the filename has blank spaces, the URL of the file that you will receive in your email, will be broken. In that case, clicking on the link will not work. You need to either download the file from your site using BlueFTP, or, if you want to see the file in your browser, you will need to copy the entire link in your browser’s address bar.
__________________ VodaHost Your Website People! 1-302-283-3777 North America / International 07092887580 / United Kingdom Military Ranking System Explained Click Here to take the royal VodaHost Tour Click Here for the VodaHost Help Centre & Tutorials Got a question? - Try a forum search! Available at the top of every page! |
|
#2
| ||||
| ||||
|
I can see that your not a L.G. for nothing Thats a great tip, and will try it out soon. Thanks *****..
__________________ Have fun Regards..... David Step by Step Visual Tutorials for the complete beginner FREE Membership Login Scripts: Meta Tags Analyzer Bluevoda Members Club |
|
#3
| ||||
| ||||
|
Nice one, Mon General!!
__________________ The moment one definitely commits oneself, then providence moves too. All sorts of things occur to help one that would never otherwise have occurred. A whole stream of events issues from the decisions, raising in one’s favor all manner of unforeseen incidents and meetings and material assistance which no man could have dreamed would have come his way. Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now. (William Hutchinson Murray) Last edited by VodaHost; 05-13-2006 at 05:01 PM. |
|
#5
| |||
| |||
|
Now that Navaldesign has sorted out my form problem, I have another question. Is there any way that when someone uploads a file an automated e-mail is sent to them confirming that the file has been received? Almost like a receipt? Thanks again Navaldesign! |
|
#6
| ||||
| ||||
|
Yes, transform the above script as follows: <?php // Receiving variables @$email = addslashes($_POST['email']); @$upload_Name = $_FILES['upload']['name']; @$upload_Size = $_FILES['upload']['size']; @$upload_Temp = $_FILES['upload']['tmp_name']; // Validation for max file size if ($upload_Size>0) { if( $upload_Size >1000000) { //delete file unlink($upload_Temp); header("Location: error.html"); exit; } $uploadFile = "uploads/".$upload_Name ; @move_uploaded_file( $upload_Temp , $uploadFile); chmod($uploadFile, 0644); $upload_URL = "http://www.yourdomain.com/uploads/".$upload_Name ; } //Sending Email to form owner $mailto = "youremail@yourdomain.com"; $mailsubj = "Enter Your Subject Here"; $mailhead = "From: $email\n"; reset ($HTTP_POST_VARS); $mailbody = "Values submitted from web site form :\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { if ($key!="submit") { $mailbody .= "$key : $val\n"; } } $mailbody .= "upload: $upload_URL\n"; mail($mailto, $mailsubj, $mailbody, $mailhead); // Autoresponder $mailto = $email; $mailsubj = "Copy of the info you Sumbitted"; $mailhead = "From: your domain name or whatever you want\n"; mail($mailto, $mailsubj, $mailbody, $mailhead); header("Location: thankyou_page.html"); ?> As usual, replace the part in blue with your own Subject and "From....."
__________________ 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! |
|
#8
| ||||
| ||||
| Quote:
__________________ 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! |
|
#12
| ||||
| ||||
| Open Notepad. Paste the above code. Now, change the above four parts in Blue with your actual values: 1000000 is the limit file size, in bytes ( 1 Mb = 1000000 bytes). You can set it to be whatever you want. http://www.yourdomain.com/uploads is yourdomain name and folder (uploads) where the file will be uploaded. Please do not change the "uploads" part, as you would also need to modify the script. Enter Your Subject Here : this is the email subject, change it to whatever you want. Values submitted from web site form : : is the first line of your email. Change it to whatever you like. Once you are done with the changes, click on File, Save As, select File Type : All files, and save the script on your computer as “uploadaction.php” I suggest that you save it inside your BlueVoda folder. Sorry, but don't know how to make it simpler. Editing apart, the procedure is only 3 clicks. As for the uploading part, open BlueVoda. Click on Tools, FTP Manager. BlueFTP will appear, and your screen has your computer BlueVoda folder content in the left part. Click on connect. If necessary, type in your IP, username and password, and click "connect". Now, the site content will appear in the right part of the screen. Go to the left side, find the "uploadaction.php" file, and simply Drag and Drop it to the right part of the screen. You are done!
__________________ 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
| |||
| |||
|
Hi Lt. General, Please let me know what do you need to help me out on how to fix this script. I have my web page already complete but not able to launch because the image upload. Thank you, Edwin cardone@coqui.net |
|
#16
| ||||
| ||||
|
I also would like to see a mod to upload multiple files.............
__________________ Have fun Regards..... David Step by Step Visual Tutorials for the complete beginner FREE Membership Login Scripts: Meta Tags Analyzer Bluevoda Members Club |
|
#17
| ||
|