WordPress.org

Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3117 closed defect (bug) (invalid)

lost of uploaded filepath of attachement

Reported by: kingbyu Owned by: andy
Milestone: Priority: normal
Severity: normal Version: 2.0
Component: Administration Keywords:
Focuses: Cc:
PR Number:

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.

Change History (3)

#1 @matt
13 years ago

  • Milestone changed from 2.1 to 2.2
  • Owner changed from anonymous to andy

#2 @andy
13 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Not an issue in mdawaffe's new uploading code, 2.1

#3 @foolswisdom
13 years ago

  • Milestone 2.2 deleted
Note: See TracTickets for help on using tickets.