(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
- Get a list of folders inside uploads directory
- Trying to generate a CSS file in wordpress uploads folder
- Confuse between forms and tables
- wordpress contact form messages not sending although it saying they were sent successfully with this php code
- How to create a widget with a populated dropdown?
- Attach and retrive multiple pdf files to post or page
- Store user form submitted information in post type
- Implement jQuery Smart wizard
- New user – Create a folder
- Using a PHP form, get the page title or any other element in the sent e-mail
- Maximum file Upload
- Sudden Upload HTTP errors, PHP uploads and memory limits are already to high to my taste. Anything else?
- form submission reverts to index.php template
- Change upload URL by mime type
- Javascript / PHP – closing the loop
- Get list of posts from attachment
- How do I stop my form from adding code to current page URL instead of re-directing. Been stuck for days
- Updating the database after parsing CSV document
- Autoloading Classes in Plugins
- custom search query database in child theme
- Right path for renaming a file in uploads folder
- Creating a WordPress addon for ContactForm7 submission (.XML file export)
- Using transients to store form notifications
- Insert data from form to database
- not able to access $_POST on backend profile update
- Creating wordpress user registration form
- Custom Plugin Develoment, Form Action
- wordpress form action page not found
- I want url from a file in media using title file
- Adding action item to admin users table and sending email
- Trouble with checked() for array of multiple checkboxes
- If input field has value Require another field – PHP
- WordPress file upload
- Upload images from one server to an other in wordpress
- Crop an image after upload on custom account page
- media_handle_upload fails with gravity form submitted image
- Restrict File Type Uploads by User on Wordress via functions.php
- Custom HTML form using PHP – help with ajax/username validation
- Form direction to .php on localhost
- How do I prevent a folder from reappearing in my home directory?
- wp_delete_attachment not working with multiple values
- Resource 404 error on multisite subdirectory install
- Form not working as it should in WordPress, but in a normal HTML site it does
- Renaming “Expand Details” within “Add Media”
- Get posts associated with media attachment
- Submitting my form to the database and then redirecting to payment site
- Passing link parameter values to form
- Processing forms with php to wordpress database
- Ajax call URL 404’ing when pushed to staging server
- Update only some custom user fields
- Post from front end form to post_meta
- Passed variable gets undefined variable error on insert on next page
- Accessing values entered via form – try again
- Nonce fail after second submit attempt
- How to set up an auto delete post?
- 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
- Trying to display user meta by “name” – not by “ID”
- Styling admin page rows in order of importance (checkboxes)
- Attachments doesn’t update
- Is custom behaviour possible when asynchronously uploading?
- How to resize an image server-side before upload?
- Headers for Contact Form are wrong
- WordPress will suddenly stop saving files uploaded by my code (ran in nopriv ajax)
- Permission functions within wordpress
- Name Input from widget displays Sidebar name instead of saved data
- Upload file to front-end form and send as email attachment
- Display default WordPress login/registration form into a modal window
- Using Nonce for my Form
- Can’t upload files
- Post Title Not showing up
- Target all images that are not the first attachment
- WP white screen of death after duping a site that works fine on same server
- Trouble using wordpress functions in a pop-up modal form
- Force string into signup form
- custom contact form no longer working (because of 3.2?)
- File Upload with Server in safe_mode
- Data inserted in database, but ajax calls error function
- upload images on front by user using form
- Edit Image/Image Details – Replace button missing
- ajax form function error
- How to pass username into form that sends data to database
- HOW TO Insert Existing PHP Code to WOrdPress
- Send foreach $_post method to contact form 7 [closed]
- Can I have a php site on subdirectory of WordPress?
- php inside HTML via shortcode? [closed]
- Where to put include php file?
- Use HTML Form Data in PHP Function – WordPress Admin Page
- How to automatically convert images to WebP on WordPress?