Note: I have made this post initially in some other place then noticed that that issued is closed. So I post here again. Sorry for any inconvenience.
Hello Greg,
We're having the same problem: files cannot be uploaded when applying for job using the Job Posting module. Emails would be fired OK. We get the following :
The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.
That message is apparently generated by file.inc
Please note that we CAN upload images using the Image/Image attach modules. We also CAN upload logos & icons. In our case uploading is not working for the Job Posting module only.
We have deleted many un-used modules, deleted & re-installed Job Posting module but still getting the same error.
Any clues?
Note: we run D5.7 job_posting-5.x-1.2 Local machine Win XP Site: LAMP PHP version 4.4.7 MySQL version 4.1.22-standard
Also got this related info form the log:
Type access denied
Date Saturday, 5 July 2008 - 12:02pm
User Anonymous
Location http://www.khaleej4jobs.com/kh4j/en/job/application/node/88
Referrer
Message job/application/node/88
Severity warning
Hostname 66.249.65.104
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | job-posting.png | 312.04 KB | bikramth19 |
| #12 | tmt-tmp-080708.gif | 3.26 KB | tcibah |
| #2 | kh4j-mods-080705-1805.pdf | 23.7 KB | tcibah |
Comments
Comment #1
gmarus commentedYou can't submit an application for a job posting as Anonymous (you must be logged in). That's why you're getting that 'access denied' error in the logs.
I have not been able to reproduce the problem of uploading attachments using default install of Drupal 5.7 and job_posting 5.x-1.2. Please provide a list of all enabled modules on the problem system (a screenshot of your modules admin page may suffice) as I would need this in order to figure out which module interaction is yielding the problem result.
Comment #2
tcibah commentedHi Greg and many thanks for your prompt response.
1. Module list is attached in as a pdf file herewith.
2. When the job application was submitted, I was logged in and received the confirmation email based that. Could something happen in the process and change the user status? I think this is a possible point to start tracing the issue.
3. I just also verified that we can upload a file as an attachment to a Book Page from the same system.
Comment #3
gmarus commentedOkay, I've had a chance to conduct a fair deal of testing with Drupal 5.7 and job_posting-5.x-1.2 but cannot seem to reproduce the errors you're getting. Using your screenshot as a guide I installed with default configs *most* of the modules you appear to be using (excluding some, like Site Documentation, that have no likely bearing on the issue). The only noteworthy deviation I made was in using a newer version of Image module (1.9) than you are using.
Note that the job posting module does not use Upload module (you can turn it off and the file attachments for job_posting applications should still work under normal conditions) and does not attach content to nodes per se. It only uses the form api 'file' element and a simple call to the file_save_upload() function to attach user provided files to an email message sent via Drupal's builtin drupal_mail() function. The first step is that the file is uploaded and saved to the Drupal temporary directory.
File_save_upload() itself calls file_move() and file_copy(), the latter function is the one apparently throwing the error message: "The selected file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename." This leads me to consider the particular configuration of your system (and possibly the host provider's configuration) as possible avenues for further investigation.
Please consider the following questions:
1. Where is your drupal tmp folder located? If you don't know offhand you can determine this by referring to Administer->Site Configuration->File System page and look for 'Temporary directory' location.
2. What is the full name of the file being uploaded? Are there spaces or non-alphanumeric characters in the filename?
2. Can you verify whether the uploaded file causing problems is actually being saved to that location and if so, does it have the same filename as on the source Win Xp system it's being uploaded from?
3. If you can't see the attached file in your Drupal temporary directory are you able to determine if the file might be getting saved to the system-wide temporary directory, often '/tmp' or '/var/tmp' on unix-based systems?
I don't feel like I have a lot of information to work with here but my guess is that this is a question of file permissions and/or the filename is being altered in such a way that it fails the check in file_copy() which is throwing that error message. However the fact that I'm using PHP 5.2.6 and you're using PHP 4.4.7 may have a bearing on this as well. Hopefully, my efforts help us get closer to a solution.
Comment #4
tcibah commentedVery helpful and timely response….. Thanks again.
There was no drupal tmp folder! We created one inside the drupal install folder, defined it as "tmp" in Administer->Site Configuration->File System - Temporary directory.
Result: Using the Job Posting module, we were able to upload files to tmp but could NOT attach a file to the email. Still getting the same error message.
Both confirmation and application email were sent OK, without the attachement.
We were able to upload files with spaces in their names, files with Arabic file names, all three extensions .doc, .txt, .pdf were OK.
tmp folder permission is set to 755.
Hope this help in resolving the issue. Appreciate your prompt support.
Comment #5
gmarus commentedSorry it's not entirely clear to me from your last message: Are you able to confirm that the files are ending up in your defined tmp directory on the server and that they have the same name as when they were chosen in the resume field of the job application form?
In your case it seems like the module is checking for an uploaded attachment because it expects it but then it can't find the file matching the name provided through the application form. So either the file name is being changed once it's saved to the tmp directory or where PHP is looking for the file is different from where the file is actually being saved to.
Do you have control over the web server or is this being hosted by a third party? If the latter, can you tell me anything more about the hosting environment (who's the provider? what kind of hosting package -- shared, VPS, dedicated?)
Comment #6
tcibah commentedYes, I am able to confirm that the files are ending up in the defined tmp directory on the server and that they have the same name as when they were chosen in the resume field of the job application form. See attached screenshot of the tmp folder.
Server: I am using a shared (reseller) hosting with Hostgator (HG). They provide good & prompt service. They have ticket system with experienced Admins as well as live support for quick questions & fixes.
We have access to standard cpanel; we can get ssh at a small fee if needed.
If you have any questions related to the server, let me know. I think we can get them answered by HG.
Comment #7
gmarus commentedThanks for confirming that for me. Unfortunately, I don't really know what else to suggest at this point. Three people have come forward with very similar reports to yours but no one has followed up to tell me whether it was eventually resolved. The only thing that seems to be common across these cases is the use of PHP4. Job posting module is using file_save_upload() (a Drupal core function) to handle the file upload and attachment. If there's a problem using this with PHP4 (but not PHP5) then I'm thinking this is a bug with Drupal core, not my module. At the very least, it would raise the minimum PHP version required since the version you said you're using is well above the documented 4.3 minimum.
Evidently, this is going to require more time and effort to resolve...please let me know if you get any new information on this issue. I'll do the same.
Comment #8
tcibah commentedRe moving to php 5, I think we can that. Our host is upgrading their few 1000s server to php5 & recent MySQL releases. Additionally, They said we can invoke php 5 for any account by adding
AddHandler application/x-httpd-php5 .php
to the htaccess file.
We thought we will wait for our turn so that HG upgrade the server & take care of that task. But since our Drupal/Job Posting module is on a separate account, we can try php 5 for that account. Will do that later today.
For possibly helping others, if you inform me of the php functions that you think could cause the error, I'll ask HG and hopefully get some more info.
Comment #9
gmarus commentedOkay, please let me know how the switch to PHP 5 goes as I'm not 100% sure it will make a difference but if would be helpful to know either way.
I'm currently investigating the php function 'realpath()' as the possible culprit based on preliminary reading at php.net and the fact that it's one of the last functions called just prior to the error message you've been receiving.
Comment #10
gmarus commentedSearching the drupal bug tracker I found this: http://drupal.org/node/130458
It *might* be worth trying the attached patch to file.inc. It's only a one-line change so would be easy to remove again if it doesn't help.
Comment #11
tcibah commentedMigration to PHP 5: We will request PHP 5 on our server. It may take a day or so to prepare for it.
Re the patch in http://drupal.org/node/130458, it seems that it is already applied to the file.
Comment #12
tcibah commentedWe have used another test Drupal/Job Posting system on the same server but in different domain/cpanel.
The tmp folder location of this system is: files/tmp relative to Drupal.
Result of job submission using this test system: the 'attach' resume file was uploaded to the tmp folder (see screenshot) but as before was NOT attached to the email. However the error message now is different showing a strange file name, indicating that the name was changed in the process as you previously hinted:
The selected file files/tmp/tmp_jQzkSm could not be copied, because no file by that name exists. Please check that you supplied the correct filename.
Note: We have not yet initiated php 5 migration; it is something we could do as a last resort as it requires some preparation.
Comment #13
tcibah commentedWe used PHP 5 and Job Posting module worked fine the resume was attached correctly to the email.
As we had other problems resulting from PHP 5 that are not related to Job Posting module, we only kept PHP 5 for a short period to do one test job submission. And the test was passed. Resume was uploaded and attached correctly.
So we can say that PHP 5 is a prerequisite.
Will keep you informed as we do more testing in the coming few days. Thanks again.
Comment #14
gmarus commentedThank you for testing that and letting me know. I suspected this might be the case as I understand there were some major changes to file-related functions between the two versions and this at least confirms my suspicions. Unfortuntately, I don't have a PHP 4 system easily available so I probably wouldn't have found this out otherwise. Thanks again.
As PHP 4 soon will no longer be supported I'm not sure what to do about this. At the very least I'll update my module documentation to inform others that PHP 4 poses problems with the application process. However I also find it a little odd that Drupal core would continue to advertise PHP 4 compatibility despite using core functions that exhibit such different behaviour. I understand this will change for Drupal 7. When I get a chance I'll try to file a bug report against core and see what happens.
Comment #15
malmax commentedNot sure if this would help,
http://drupal.org/node/263535#comment-934965
Comment #16
gmarus commentedClosed after several weeks of inactivity
Comment #17
edem commentedHello please i installed the job posting for drupal 6 module to on my site, however i realised that whenever a user applies for a particular job advertised the application is not sent to whoever advertised the job but the confirmation mail is sent to the applicant. I think i may be having some issues with the processing of the application email to the whoever placed in the job advert. Please can anyone here help me on this one..
Thanks
Comment #18
bikramth19 commentedI have created more field using cck field in job posting content type. As result shows the cck field in the below of the of the default module field. I just want to bring it up the cck field above the default module. Please help me to change it..
I have attached the snapshot.
Comment #21
nevets commentedFixed title after deleting spam comment