bilalgmughal760
Forum Replies Created
-
Forum: Plugins
In reply to: [Donations via PayPal] ustomize Button Layout & Change Text with CSS?Thanks for your reply, I customize the plugin according to my need.
Forum: Plugins
In reply to: [CMB2] Issue with CMB2 plugin field type “file”Can I use the file type field while creating a group of fields using the CMB2 plugin? If I can use then tell me what should be code for it I used this code for defining field :
array( 'name' => __( 'upload flag', 'wp-job-board-pro' ), 'id' => 'seaman', // Ensure it's a unique ID 'type' => 'file', 'options' => array( 'url' => false, // Do not display the text field for the file URL ), 'text' => array( 'add_upload_file_text' => 'Add File', // Button text for adding/uploading files ), 'query_args' => array( 'type' => 'image', // Restrict to image files ), 'preview_size' => 'small', // Set the size of the preview image 'save_id' => true, // Save the file ID in the database ),
for displaying file to the front end I use this code :
if (!empty($item['seaman_id'])) { echo '<p>Uploaded Files:</p>'; echo '<ul>'; foreach ($item['seaman_id'] as $file) { if ($file['error']) { // Handle the upload error echo '<li>File upload error: ' . esc_html($file['error']) . '</li>'; } else { // File was uploaded successfully echo '<li><a href="' . esc_url($file['url']) . '">' . esc_html($file['title']) . '</a></li>'; } } echo '</ul>'; }
I used checks while fetching the file like as echo ‘<p>Uploaded Files:</p>’;
but I can see it not enter into if condition.When I upload file and trying to update the form uploaded file disappear and not saved into database but all other fields are store and fetching properly in the same group of fields with same submitting form.
Forum: Plugins
In reply to: [CMB2] Issue with CMB2 plugin field type “file”Yes! I have done different checks too. my code :
if (!empty($item['uploaded_files'])) { echo '<p>Uploaded Files:</p>'; echo '<ul>'; foreach ($item['uploaded_files'] as $file) { echo '<li><a href="' . esc_url($file['url']) . '">' . esc_html($file['title']) . '</a></li>'; } echo '</ul>'; }
?I see my files are not saved in my media folder or anywhere in the database.
I use group fields and all other types of fields like text, textarea, etc are working fine and handling easily except for this “file” type. Is there anything that I am missing to store that file on save that file or probably missing to step to handle the save option?Forum: Plugins
In reply to: [CMB2] Issue with CMB2 plugin field type “file”I am very thankful for giving me your valuable time!
I am sharing my issue with more clearly in the video : https://www.youtube.com/watch?v=GnT4CNNsGyU
Main issue : When end user upload file and update the form it disappear from the form that’s why it not shown in the Profile page (where i am fetching filled data.).I used this code for taking data from the front end user :
“array(
‘name’ => __( ‘Image’, ‘wp-job-board-pro’ ),
‘id’ => ‘upload_fles’,
‘type’ => ‘file’,
‘ajax’ => true,
‘multiple_files’ => false,
‘mime_types’ => array( ‘gif’, ‘jpeg’, ‘jpg’, ‘jpg|jpeg|jpe’, ‘png’ ),
),
"
/////////////////////////////////////////////////
and this is my code for displaying it on the front end :
" <div> <?php if (!empty($item['upload_fles'])) { echo '<p>Uploaded Files:</p>'; echo '<ul>'; foreach ($item['upload_files'] as $file) { echo '<li><a href="' . esc_url($file['url']) . '">' . esc_html($file['title']) . '</a></li>'; } echo '</ul>'; } ?> <p>my files</p> </div> "[ Login details deleted, never post that on the Internet please. Ever. ]
- This reply was modified 1 year, 1 month ago by bilalgmughal760.
- This reply was modified 1 year, 1 month ago by bilalgmughal760.
- This reply was modified 1 year, 1 month ago by Jan Dembowski.