(Update to answer: 05.27.15) What finally worked is using ABSPATH:
$folderPath = "/jobtracking/files/standard/{$projID}";
mkdir(ABSPATH.$folderPath, 0755, true);
$filename = basename($_FILES['Attach_Files']['name']);
$filetype = $_FILES['Attach_Files']['type'];
$datei = "files/standard/{$projID}/{$filename}";
$target_path = ABSPATH.$folderPath . "https://wordpress.stackexchange.com/" . $filename;
if(move_uploaded_file($_FILES['Attach_Files']['tmp_name'], $target_path)) {
mysql_query("INSERT INTO files (files.name, files.project, files.user, files.added, files.datei, files.type, files.folder, files.visible) VALUES('{$filename}', '{$projID}', 5, UNIX_TIMESTAMP(now()), '{$datei}', '{$filetype}', 0, ' ')");
}
chmod("{$target_path}", 0755);
I also made sure to change the 0777 to 0755.
Related Posts:
- Front end file upload returning wrong attachment url
- Upload images and attachments from frontend form
- File upload, uploads only file name
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Upload Image in a WordPress page using PHP
- Attach previously uploaded image to post – current code has unexpected results
- wp_mail file attachment not being placed in upload folder?
- How to get the filename from file system and create a download link?
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- File path for attachments outside of wp-content/uploads
- How to change upload directory in wp_handle_upload
- Decrease file size upload in Media
- How to register images uploaded via FTP in media library?
- How to insert PHP code in a WordPress Post
- Has anyone tried putting PHP ActiveRecord on WordPress?
- Handling error states with admin_post
- Debugging upload problem: What part of WP does actual image-resizing?
- Creating wordpress user registration form
- Add custom field to attachments in a specific category
- Conditional Statement – check if post has an attachment image
- How to upload imagick resource to media in wordpress
- Accessing a random image via ajax
- Make WordPress upload directory outside wordpress root with custom url
- submit the form to same page
- How to enlarge the media file upload size in wordpress admin
- Custom image upload
- Ajax form submit within a Post Metabox
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Get most recent media upload
- Link to the parent post in attachment page
- Convert all images to PNG on file upload
- WordPress (3.9.1) MultiSite Permissions. Is chown the answer?
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- how to retrieve uploaded url of zip files
- Custom location for attached images
- Using a `Template Parts` folder instead of an `Includes` folder in a Custom WordPress Theme
- WordPress Search Results for Multiple Post Types
- My form action url is being prepended with a directory that does not exists
- Custom profile field with birthday. Troubles with
- Need help with Google drive API [closed]
- Send multiple attachments with wp_mail in PHP
- Post + form + action + results on the same page
- Why Won’t My Inputs in a form with a Get method work together?
- How to get the value of input hidden html from text editor to custom page template?
- Contact form won’t submit
- How to show a ‘correct’ message after submit a form?
- db converts decimal number wrong
- WordPress function when file is uploaded, deleted or edited
- “operation successful” message
- User register hook is not working in woocomerce register form
- How to send form data from WordPress (Meta Box) to an OData service?
- Upload multiple files in randomly generated folder using wp_upload_bits
- WordPress shortcode returns the data before
- Form Submission Not Working In Custom Theme
- Can’t upload CSV file to plugin directory using custom upload form in admin panel
- Why does my user not get added to the database on custom registration?
- How do I increase the upload size only when editing special pages?
- Get URL of Featured Image After wp_insert_post()
- WordPress İmages Upload & Delete Error
- Allow user to Upload image and manipulate it on the frontend
- Pass important values server-side when processing form
- Make a page (url) not cacheable [closed]
- Attaching images to posts manually (i.e. with custom code, without the use of an API)
- How to load previous or next attachment with jquery ?
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- Add class to all img if they have a certain ACF field
- Cascading dropdown select search based on Parent Page & Child Page
- I can’t set image ad fatured programatically
- $_POST returning empty values
- How to send custom form submissions to WordPress Database?
- I want it to detect the duplicate comment and give a warning on the same page
- Trying to generate a CSS file in wordpress uploads folder
- New user – Create a folder
- Maximum file Upload
- Change upload URL by mime type
- custom search query database in child theme
- Right path for renaming a file in uploads folder
- Using transients to store form notifications
- wordpress form action page not found
- If input field has value Require another field – PHP
- WordPress file upload
- Form direction to .php on localhost
- wp_delete_attachment not working with multiple values
- Form not working as it should in WordPress, but in a normal HTML site it does
- Renaming “Expand Details” within “Add Media”
- Submitting my form to the database and then redirecting to payment site
- Ajax call URL 404’ing when pushed to staging server
- Update only some custom user fields
- Dynamic form variables for post meta
- Save the outputted image into the Media Library, with a different filename and extension
- 403 (Forbidden) delete file image in themer folder
- Headers for Contact Form are wrong
- Permission functions within wordpress
- Using Nonce for my Form
- Can’t upload files
- How to pass username into form that sends data to database
- Can I have a php site on subdirectory of WordPress?
- WordPress directories not writable after PHP version upgrade
- Custom form that stores data in mysql database
- Putting form result in my database