After submitting node the file upload field available again Drupal 7 - drupal

I created a content type and there is a file upload field. The user uploads the file and submits the node. Then the file upload field will be available again, so the user can upload a new file.
How to implement this instead of you only see the file name and remove button?
Thank you!

If you want to upload multiple files in your file field, you should make sure that the field settings allow for it.
At Home » Administration » Structure » Content types » [Your content type] » Manage fields, you should edit your file field. Scroll down to the Field settings and set the Number of Values to Unlimited if that's what you want.

Solved! in _node_update and _node_insert delete the file field value from the database.

Related

show download link if file already uploaded or show file upload field in gravity forms

I have a form created by gravity forms which will allow the user to enter the data and upload two files (form has two input file fields - gravity forms provided file upload field). Once the user submit the page, I will save the data in to custom table with file path as one of the column inside the table.
But once form reloads, it will show the same form with already entered data, but don't know how to show the file link inside the form.
What I am trying to do is, I have to show the link with remove button if file already uploaded or show the file upload field again to allow user to upload the file again.
Could somebody help me please?
I guess when you will store the entered data on the custom table, store the file names as well.
Then have another function to check if the file is in the specified directory (ex. uploads).
This is a lazy solution, so keep an eye on your thread for a better one.
I am not using gravity forms file upload field as even sent mail with priority support asking for is there any hook to know when user clicked "X" button of uploaded file(this will be shown once user clicks on submit button after uploading the file), but they replied, they don't support customization and pointed to 3rd party developers.
So what I did is, removed file upload field and used html field, which I am showing manual file upload (html input type file) field if no file uploaded or showing the file link with remove button. This remove button handled via javascript which will update some hidden field and after submit I know user removed the file or not.

Customize page in concrete5

I had created a custom page(test) in concrete5 through UI.
Dashboard->Sitemp->Addpage
I created a form in this page.After form submit I want to store those details in DB.I just want to where this page is saved in app folder structure.So that I can connet Db and save records.
The page is not saved anywhere in the folder structure. It is saved in the database.
If you are using any of the forms add'ons however they will save the data in the db and you'll have access to it from the dashboard report section.
If you really want to be able to control it yourself then you will need to create a single page through code, add the form to it and write the code to process the page.
The single page would be in the single_pages folder and its controller in the controllers folder
Replace "my_profile" with your php file name following the instructions below:
Sign in to the concrete5 dashboard, and go to Themes & Page Types > Single Pages. Find the "Add a Single Page" form at the bottom of the list, and enter "my_profile" at the bottom (or whatever the name of your single page.) Do not include ".php" in the field.
Per the instructions on Concrete5:
http://www.concrete5.org/documentation/developers/pages/single-pages

Can the administrator attach a file to a Woocommerce order?

I was wondering what the best way to achieve the following:
Customer makes an order (normal functionality)
Once order is placed, the admin needs to upload a pdf attachment related to the order
The customer can then view the attachment(s) when viewing the order
I can see there are plugins where the custom can upload supporting files, but none that cater for the admin to do this.
Why not add a new custom field for that product?
(source: chizzledesigns.com)
So once your client generates the PDF they can upload it just like normal into the media gallery and add the link (or at least the file name) into the Order PDF field for that specific order.
Next you would need to decide how to show the user that in your theme but querying for that meta value should not be difficult.
With default woocommerce functionality the main way to do this is to create virtual downloadable product (but not available on shop pages) and upload your pdf file there. Then when the order would be ready, you should grant access to that virtual product at the order edit page.

show more fields on user/id on Drupal

I'm searching the way to show custom fields that I've added on the users in the default view for the user/11. It displays only the username and the History.
I can make a view for that but I want to use the original page (user/id).
Thanks for your help !
Take a look under Administration » Configuration » People » Account settings » Manage fields, and locate the panel Fieldname field settings. There you should be able to make the field visible when someone view the user's profile by making the field "Public".

WordPress Media as a Custom Post Type

I am building a WordPress website that will allow members to upload media such as videos, images, etc. They will do this on a public form at for example: domain.com/upload
The form will ask for a Title, a brief summary, show some categories to choose from, and finally a file uploader. The user will then be able to submit the form and it will appear on the site as a post but instead of being just text it is a piece of media.
I have created a custom post type and all seems to be fine, the problem I have is how to deal with the media upload, as the default WP method is to upload an item and then manually insert it into the post (and you can have as many inserted as you like). Where as I want users to be only able to upload one file per post and not have to insert the file into a post because the file itself is the post. They will also be able to upload a featured image.
Any ideas on how I can develop this? Thanks.
You could use WP upload methods to upload your file to the server. Then (depending on your upload's media type) you would insert HTML representation of the file into the post (e.g. parse a text file, create tag for image or embed a video).
If you want to see some working example, please let me know. I just outline the flow:
wp-handle_upload() to physically upload a file
wp_update_post() or wp_insert_post() depending on whether you're creating a new user post or editing existing one. Both methods require one argument - Post object. That's where you put your content (as a post_content field of course) and post data

Resources