I have a webform with a file upload field. When I upload a file in this field, without submitting the form, the file is uploaded using AJAX. Now, I want to make some modifications during this call.

Now, the arguments accessed using arg() give ajax arguments. Whereas I need to access the current node's nid when this AJAX request is being made. But arg() is of no use, as it is giving ajax arguments, e.g. arg(1) gives "ajax".

Now, my question is how do I access my node's nid during this AJAX call?

For more clarity, here are more details for what I'm trying to do:

I want to rename the file being uploaded using ajax. For this, I'll modify the $_FILES variable. But the renaming is to be done according to a pattern which includes the current node's nid.

  • What if the node is new and doesn't have an ID yet? – Clive Oct 27 '14 at 10:41
  • No. The thing is that I am using Webform. A webform is visible only after that particular webform node has been created. So. – shivams Oct 27 '14 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.