Jump to content

Link upload


matjazp
 Share

Recommended Posts

Yes, I know, the title is strange, let me explain. I have files field where users in admin upload attachments, like pdf, zip, doc, etc. I render those attachments in my template, nothing fancy here. But sometimes there is a need to display a link to some file (document) that is not part of PW. Now, the user has to download the document and upload it to the files field (and add some description). Ideally, there would be another button along with the "Upload file" eg. "Insert link" that would upload some dummy file and then I could use custom fields support for file and image fields to add the URL. Any other ideas? I know I could use repeaters, but I would like to make it simple.

  • Like 1
Link to comment
Share on other sites

1 hour ago, horst said:

For me, uploading a file/image from URL works by simply copy paste the URL into the upload inputtextfield. The browser / OS does all necessary then.

Oh, didn't know that, thanks for the tip! But the point is that I don't want to upload a file. Maybe Robin's module adopted to my needs is the way to go... But at the and, I stil need some dummy file. Will think about (if users really want's this).

  • Like 1
Link to comment
Share on other sites

On 12/30/2019 at 6:11 AM, horst said:

For me, uploading a file/image from URL works by simply copy paste the URL into the upload inputtextfield. The browser / OS does all necessary then.

@horst - what do you mean by this?  I don't see anywhere to input any text in a file or image field.

Link to comment
Share on other sites

Another question: while editing a page, is it possible to upload a predefined file? I have files field, there is "Upload file" button. Let say that I have another button, "Upload specific file" and I want that clicking this button automatically upload a predefined file, located on the server, not at the client. Just like "Upload file" button but without the file selection window, opened by the browser. I know all browsers prevent prefilling file values without the user interaction, so input type=file is not an option? I could (didn't yet try) add that preselected file to my files field via ajax call (any security issues with that?) but after that I would like all the acctions supported by InputfieldFile to take place (render "uploaded" file).

Link to comment
Share on other sites

@gebeer - FYI... I modified Robin's AddImageUrls module and adapted it to work with file fields now.  It's called the AddFileUrls module.

@matjazp I'm not sure I fully understand what you want, but maybe you could try the new "AddFileUrls" module and then use some kind of hook to modify and pre-fill the default value of the url in the file field?

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...