0

I'm successfully using the technique covered in this question: Simple HTML file field uploads with Assets and Safecracker

<fieldset>
   <label for="event_url">URL</label>
   <input name="event_url" id="event_url" type="text" placeholder="http://" />
   <label for="event_upload">Upload a File</label>
   <input type="file" name="event_upload" /> <input type="hidden" name="event_upload_filedir" value="2" />
</fieldset>

It works, but it seems to be uploading the file twice. Here's my output code:

check: {event_upload:total_files}
{if "{event_upload:total_files}"!=''}<p><b>Download:</b> {event_upload backspace="2"}<a href="{url}">{filename}</a>, {/event_upload}</p>{/if}

That results in this in my web page:

check: 2

Download: TEST2_1.pdf, TEST2_1.pdf

If I check the entry in the Control Panel, it only displays 1 file. If I save the entry via the Control Panel, the issue is corrected, and only 1 file is output.

Update: If I save the entry via my Safecracker Edit form, with the same field code, nothing changes.

Any solutions for this?

EE 2.5.2 (I'm not in a position to upgrade presently)
Assets 2.0

Thanks!

  • Do a test and resave the entry, does it fix the duplicate ? – stuartmcd69 Jun 17 '13 at 13:23
  • Thanks for the quick reply: I pointed out that saving the entry via the CP, without making any changes, corrects the issue. Saving the file via my Safecracker edit form, with no changes and an empty upload field, changes nothing. – Mark J. Reeves Jun 17 '13 at 13:28
  • I raised the issue with Lisa from P&T and we never successfully found the issue. I believe it to be some sort of reminence of a field type change during the build (file field > Assets or something like that). I was using 2.5.5 so it may not be EE related or not... Hasn't popped its head up since launch, luck not coincidence. – stuartmcd69 Jun 17 '13 at 22:34
  • We ended up switching to {field:field_name}, rendering the Assets widget, and overriding its CSS to make it better match the page. – Mark J. Reeves Jun 18 '13 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.