Jump to content

Best way to add upload form to digital options


Recommended Posts

Good evening all.

I'd like to add a simple upload form to the digital options tab when creating/editing a product.
In the event that one forgets to upload a file first, it would suck having to navigate to the upload section and loose all the data.

Anyone have any ideas on what would be the best approach to do this?

Link to comment
Share on other sites

Yea, I didn't even think to use the drop zone, that would be even better... I was able to figure out how to add the regular upload form though.

For anyone interested.

I placed this code above the Custom File Path in /admin/skins/default/templates/products.index.php

<p>Select image files to start uploading. There is a max filesize of {$upload_max_filesize}.</p>
<input name="file" id="uploader" type="file" class="multiple">
<input type="submit" name="submit_cont" value="{$LANG.common.upload}">

And this code right below global $lang; in /admin/sources/products.index.inc.php

$select_button = false;
$mode = FileManager::FM_FILETYPE_DL;
$path = "public";
$fm  = new FileManager($mode, $path);
if (!empty($_FILES) && Admin::getInstance()->permissions('filemanager', CC_PERM_EDIT)) {
	if ($fm->upload()) {
		if ($fm->buildDatabase()) {
		} else {
		if (count($_FILES)>1) {
		} elseif ($_FILES['file0']['size']>0) {
	} else {

You will need to change the $path to where you store your files.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...