ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Hidden SafeCracker File Field?

November 02, 2012 7:18pm

Subscribe [1]
  • #1 / Nov 02, 2012 7:18pm

    I’m finding myself needing to save an external URL (an image file) locally via a SafeCracker form.

    The circumstances are thus: I’m fetching a remote XML via Phil Sturgeon’s REST module. The XML has, among other things, a record of an image on the remote server. I need to be able to take various bits of data from that XML and save them as a local entry, and one of those bits is an image. On top of it all, all the fields except for the “Submit” button need to be hidden.

    Is this possible?

  • #2 / Nov 05, 2012 4:50pm

    Dan Decker

    7338 posts

    Hi Michael,

    In theory, every part but the image. Even if you hide the file input using CSS or JavaScript, you browser expects the image/file to be sourced from the local machine. It has not concept of pulling a file from one server an setting it on another.

    The best you could do would be to capture the URL of the original image. I’m afraid getting it into an entry would be a manual process, or handled outside of ExpressionEngine.

    I could trot this over to Development and Programming and give those folks a chance to prove me wrong though.

    Cheers,

  • #3 / Nov 05, 2012 9:36pm

    Hey Dan,

    I’ve given this some more thought, and I realized that there are already add-ons that fetch remote images and save them locally - imgsizer and CE Image. I can grab a local image URL from those add-ons and stick it directly into the custom field as plaintext. The only question is, how important is it for the file field’s data to include the {filedir_#} variable? That aspect might be the trickiest part of this if it’s required.

  • #4 / Nov 06, 2012 5:46pm

    Dan Decker

    7338 posts

    Hi Michael,

    You could set the CE Image local “made” folder as an Upload Destination in the FIle Manager. Then run a sync operation and you could access those images in a channel entry using the File field-type.

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases