I hope this works for everyone. Please read the READ ME FIRST file, it gives you complete directions on how to install this form and needed changes to make it work correctly.
Since the UPLOAD-POINT file is to big for me to include in the total set up, you need to download it from here and upload it on your server first then upload my files. My files will overwrite 4 files in the "upload" folder.
If you have questions, I am very limited in my knowledge of php, but I will try to do my best.![]()
Hi ladybugmom
Thanks for a great contribution, which I am currently perusing.
In the ReadMeFirst, Point 9 states:
"You can specify which files you do not want uploaded."
Searching through the files for how to do this, I found many references to $up_ignore, and am wondering if this is what Point 9 refers to?
However, while the list of possible exclusions greatly exceeds the 5 provisions for up_ignore, this function also seems limited to whole filenames, eg index.php.
Instead what I want to do is limit the uploads to files with .jpg, .png, .gif, .pdf and .txt extensions only, which is contrary to the up_ignore function.
Could you please enlighten.
The above is listed on the site, I guess I read it as file extensions to ignore. Sorry about that, I have emailed the fella from UPLOAD-POINT to see if he has an answer or if it is even possible to designate extensions. I had planned on a little blurb by the upload button stating which extensions we would except.Code:$up_ignore1 = ""; $up_ignore2 = ""; $up_ignore3 = ""; $up_ignore4 = ""; $up_ignore5 = ""; Files to ignore(not list) in the upload directory. ".htaccess" is ignored by default.
I will post his reply as soon as I get it.
Maybe someone here knows more about php code and would know what to put where to designate which files to accept.
![]()
Can anyone help with the valuation and send of info
I have in header
$error = false;
$mhs_type = '';
// Pulldown to select a type
// Set default selection:
$default_pulldown_selection = '0';
//build an array of entries to be displayed on the template for field 'mhs_type':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please select');
$pulldown_contents[] = array('id'=>'1', 'text'=>'Campervan');
$pulldown_contents[] = array('id'=>'2', 'text'=>'Coachbuild');
if (isset($_GET['action']) && ($_GET['action'] == 'send')) {
//For validation, you're looking for the contents of the $_POST['my_pulldown_menu'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['mhs_type'])) ? $_POST['mhs_type'] : $default_pulldown_selection ;
if (!zen_validate_email($contact_email)) {
$error = true;
$messageStack->add('mhs_form', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
}
// Validation for the 'mhs_type' selected field here.
if ($pulldown_selected_item==0) {
$messageStack->add_session('header','Please select motorhome type','error');
}
//assemble the email contents:
$email_text = 'MHS Form Data Submission: ' . "\n" .
'------------------------------------------------------' . "\n" .
'mhs_type:' . "\t" . $mhs_type . "\n"
In the template
<label class="inputLabel" for="mhs_type">MotorHome Type:</label>
<?php echo zen_draw_pull_down_menu('mhs_type', $pulldown_contents, $pulldown_selected_item). '<span class="alert">' . ENTRY_REQUIRED_SYMBOL . '</span>'; ?>
<br class="clearBoth" />
So far so good....when I open form online all looks good with options showing but the form will submit even if the data in the 'TYPE' box is left blank of just with option 0
Sorry for the long post but I just cannot get the form to validate properly...any help please.
- ZenCart v:1.3.9h -
www.slstamps.co.uk
Hi ladybugmom
Uploaded the mod and it works OK. However:
1. Further to the selective file upload query, I found some pointers at:
http://www.reconn.us/content/view/30/51/
http://www.plus2net.com/php_tutorial...ile_upload.php
Just need to work out where to put same.
2. In line 164 of \includes\templates\YOURTEMPLATE_(RENAME)\templates\tpl_submit_product_default.p hp
I am not sure about the rel="popup console 600 400" especially with respect to the existing popupWindow function and the css. While I had to adjust the dimensions to 850 600, and would prefer the window to be aligned centre below my header, I could not get to control its display in css.Code:<a href="http://www.yourdomain.com/upload" rel="popup console 600 400"><?php echo zen_image_submit(BUTTON_IMAGE_UPLOADED, BUTTON_UPLOADED_ALT); ?></a>
3. I still have not worked out the $up_ignore function.
Best Regards
I received an email back from the UPLOAD-POINT in regards to selecting only certain file extensions to be uploaded and this was his reply. I have not used it yet, but wanted to pass it on to those who wanted to used it.
Hello Ladybugmom,
Sorry so long to reply, I've been out of town.
The latest version (1.62 Beta) does not have an easy fix. This is because of the addition of the ability to upload multiple files at once. The version before (1.61 Beta) is essentially the same, has an easy fix, but doesn't allow multiple files to be uploaded at once.
I've had many requests for this, but I've not had any free time for a while to try to work on it. A user has sent his fix for 1.62 Beta if you want it, but it's pretty long and may have a few minor problems.
I'm sorry I couldn't have been of more help, but I truly have not had any time to work on it lately.
Regards,
Todd
The easy ;) fix to 1.61 Beta is this:Code:In index.php after line 306 is: // Path from domain name to upload directory and line 315 is: // Redirect to upload page. Replace the current code between these lines with this: $file_ext = basename($_FILES['ftp_file']['name']); $ext = substr($file_ext, strrpos($file_ext, '.') + 1); $upload_dir = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/"); $target_path = $upload_dir . basename( $_FILES['ftp_file']['name']); if (($ext == "ai") || ($ext == "eps") || ($ext == "psd") || ($ext == "pdf") || ($ext == "png") || ($ext == "gif") || ($ext == "tif") || ($ext == "rar") || ($ext == "7z") || ($ext == "zip")) { if (move_uploaded_file($_FILES['ftp_file']['tmp_name'], $target_path)) { chmod($upload_dir . basename( $_FILES['ftp_file']['name']), 0644); echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name']). "$p2"; } else { echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name']). "$p2"; } } else { echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name']). "$p2"; } The new line 311: if (($ext == "ai") || ($ext == "eps") || ($ext == "psd") || ($ext == "pdf") || ($ext == "png") || ($ext == "gif") || ($ext == "tif") || ($ext == "rar") || ($ext == "7z") || ($ext == "zip")) { is where you can add or remove file types. If you just want .jpg files then it should be: if (($ext == "jpg")) {
Hi Ladybugmom
Since my last post, I did a developer-tool-kit search for "upload" and "upload_files" etc and discovered the following zen cart files both provide for extensions:
admin\includes\classes\upload.php
includes\classes\upload.php
which function with
admin\mail.php
admin\media_manager.php
As I am not good with php, the problem remains how to incorporate these snippets into your mod.
However, your fix may save me a lot of bother. With the limitation of only applying to one file uploaded at a time, I suppose a little note to the uploader may cater to situations where more than one file is to be uploaded.
I imagine one can upload one file after another by multiple pressings of the "Upload your file" button before finally pressing the send button for the form. If this is the case, the form should provide a place to list the files so uploaded.
Best Regards
This form's working great so far (many thanks to ladybugmom!). The only problem is when I tried limiting the type of file uploads.
I did the above instructions. Here's how my code turned out:
// Upload
// Path from domain name to upload directory and line
$file_ext = basename($_FILES['ftp_file']['name']);
$ext = substr($file_ext, strrpos($file_ext, '.') + 1);
$upload_dir = ($_SERVER['DOCUMENT_ROOT'] . "/$fileupload_dir_name/");
$target_path = $upload_dir . basename( $_FILES['ftp_file']['name']);
if (($ext == "jpg") || ($ext == "jpeg") || ($ext == "psd") || ($ext ==
"pdf") || ($ext == "png") || ($ext == "gif") || ($ext == "tif") || ($ext
== "cdr") || ($ext == "eps") || ($ext == "tiff") || ($ext == "bmp") || ($ext == "ai")) {
if (move_uploaded_file($_FILES['ftp_file']['tmp_name'], $target_path)) {
chmod($upload_dir . basename( $_FILES['ftp_file']['name']), 0644);
echo $p."$l_upload13 ". basename( $_FILES['ftp_file']['name']). "$p2";
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name']). "$p2";
}
} else {
echo $p."$l_upload14 ". basename( $_FILES['ftp_file']['name']). "$p2";
}
// Redirect to upload page.
But when I finished uploading an image, this message appeared briefly:
Warning: basename() expects parameter 1 to be string, array given in /home/ncom2/public_html/imuniforms.com/upload/index.php on line 307
Warning: basename() expects parameter 1 to be string, array given in /home/ncom2/public_html/imuniforms.com/upload/index.php on line 310
Warning: basename() expects parameter 1 to be string, array given in /home/ncom2/public_html/imuniforms.com/upload/index.php on line 321
There was a problem uploading
Automatically redirecting to the Upload-Page
-----------------------------------------------
Uploading then failed. I have about zero knowledge of php. Can somebody enlighten me?
It would be much appreciated!
Grateful zencarter