#3117 closed defect (bug) (invalid)
lost of uploaded filepath of attachement
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.0 |
| Component: | Administration | Keywords: | |
| Focuses: | Cc: |
Description
Description of bug
I used the inline uploader to upload an attachment (PDF) file. The file is uploaded into an uploads directory. When clicking the "using filename" button in the inline uploader options menu, the upload-directory path portion of the url is lost, leaving only the file name. For example, when the url should be:
http://example.com/upload-directory/myupload.pdf
it instead is just:
myupload.pdf
Problem code:
The problem comes from an incorrect ab entries which are created from a line in trunk/wp-admin/inline-uploading.php (currently line 251) which looks like:
ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$filename}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
The problem is that a few lines earlier $filename was set with:
$filename = basename($attachment['guid']);
and the basename() function took off all of the path part of the URL.
Suggested fix:
Change line 251 to be:
ab[{$ID}] = '<a id=\"p{$ID}\" href=\"{$attachment['guid']}\" onclick=\"doPopup({$ID});return false;\" title=\"{$title}\">';
so that the full filename is preserved.
Not an issue in mdawaffe's new uploading code, 2.1