1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom Image Upload...

Discussion in 'XenForo Development Discussions' started by rainfall, Jan 22, 2014.

  1. rainfall

    rainfall New Member

    I am trying to do a custom "Post Thread".

    upload_2014-1-22_16-47-28.png

    Now now.... i am editing forum.php and create a new function for this.
    Lets say my input file called "FILE", which is suppose to be only image can be uploaded.

    How do I use this object???
    For the other input text, I know we have to use
    $this->_input->filterSingle('product_name', XenForo_Input::STRING)

    How about the uploaded file?? How do I call it?? I need to save the image in separate folder.

    Any help will be appreciated. Thanks
     
  2. Nobita.Kun

    Nobita.Kun Well-Known Member

    For file uploading:
    PHP:
    $image XenForo_Upload::getUploadedFile('name_attr');
     
  3. rainfall

    rainfall New Member

    yeap, i used it....
    I have added enctype="multipart/form-data" on my form as well.
    and add that declaration --> $image = XenForo_Upload::getUploadedFile('name_attr');

    how do i use this variable $image??? how to get the filename??

    say i want to upload to a specific directory, how???

    thx in a million....
     
  4. Nobita.Kun

    Nobita.Kun Well-Known Member

    To get filename:
    PHP:
    $image->getFileName();
     
  5. rainfall

    rainfall New Member

    i tried that but it wont work....
    it gives me this error
    Call to a member function getFileName() on a non-object in /var/www/xx/library/XenForo/ControllerPublic/Forum.php on line 644

    getFileName is under diff class.... XenForo_Upload.

    You can refer to my code in this thread.
     
    Last edited: Jan 23, 2014

Share This Page