HTML Upload Problem, Can someone tell me about requirements? - upload

Literally, I am unable to upload anything to my server via the normal HTML file input type. Ok, Here's my setup.
-Ubuntu 9.10
-LAMP configuration
-File upload limit set to 50 mb in the php.ini file
-All the files that I try to upload are less than a meg a piece.
-I am using the standard HTML <input type='file' name='userfile' size='20' />, and the form has the correct EncType setting.
What I'm asking about is if there is setting somewhere that I'm missing that is throwing errors, or some such thing. I've checked permissions as well. www-data is in complete control, and there doesn't seem to be a problem at all, along those lines.
Thanks in advance.
[EDIT] Fixee link: http://www.fixee.org/paste/p3jfr1b/

do_upload() method accepts the name of the field not the value of the field as it's argument.
Just use ->do_upload ( 'userfile' ) and it should work.
Also the INPUT field does not have a enctype attribute, the form does.
See this for more info on uploading files with CodeIgniter.

Looking at the line: if (!$this->upload->do_upload($_POST["userfile1"])) {
I suppose you should use $_FILES['userfile1'] instead of $_POST['userfile1']?

Related

Get Title of html file which is downloaded on my machine in automation anywhere

I'm a newbie and this is my first try at Automation anywhere bot building.
I need to get the title of a html file downloaded on my machine.
So, basically I need to traverse the html and get title.
I found questions like Use Xpath to get all the rows of a table after a specific row in Automation Anywhere which speak of xpath and html traversal.
But, I cant seem to find any article which says how to get source code of a html file in my computer. Nor, where to put these xpath codes.
Maybe everyone knows and as I'm a new, I can't figure it out.
This is what I tried...
I renamed the file to xml and tried to start a xml session and get the node //html/title
But it throws the below error at start session.
All help is sincerely appreciated.
Thanks
Another workaround would be: rename the file to text and read the title from it.
Rename HTML file to TXT file.
Using Read From CSV/Text command read the text file.
Within the loop, use if condition on variable, FileDataColumn(1) if includes <title>
Using string operation before and after command, Before: <title> After: </title> and assign the output to a variable, and that would be the HTML title.

File download works from g:link but doesn't work from g:imageButton

I need to change a file download "button" from a g:link to a g:imageButton. They both call the same method in the controller with the same parameters. The g:link and g:imageButton both execute the same code with the same parameters so far as I can tell. The new g:imageButton doesn't give me a csv file download, however. It executes without any problems, but doesn't create the file download.
Both use GET. The g:link (which works) gives this message in the console:
Resource interpreted as Document but transferred with MIME type text/csv:
Why would changing from a g:link to a g:imageButton cause the file download to stop working?
Thanks.
The solution was to use g:actionSubmitImage. g:imageButton isn't in the grails 2 docs, but it works in other places in our code base that are not doing file downloads.

Vim html.erb snippets?? snipMate Need a vim tip

When I'm in an html.erb file, I get no snipMate snippets.
I would like both HTML and Ruby, or just HTML would be fine,
How would I do this?
Would I need to write a set of snippets?
If so, is there a way of pulling in existing snippets without copying them?
Is there a way of telling vim to go into html mode when it sees .html erb?
You can use an autocmd to set the filetype to html when opening a ".html.erb" file. This could have unwanted side effects for plugins that work for ".erb" files.
autocmd BufNewFile,BufRead *.html.erb set filetype=html
You can also load more than one set of snippets by using a dotted filetype:
autocmd BufNewFile,BufRead *.html.erb set filetype=html.eruby
See :help snippet-syntax in the snipMate help for more info.
Snippets are stored in directory called snippets somewhere in your ~/.vim folder.
If you look there, there is usually one file per filetype, there is a c.snippets, a ruby.snippets, so it seems what you have to do is to create an erb.snippets there with what you want.
Eventually you could copy the content of ruby.snippets and html.snippets into your new erb.snippets.
Alternatively you can search on github, some people have posted their own erb.snippets configuration. For example, there is a nice collection there :
https://github.com/scrooloose/snipmate-snippets
The best thing would to try first to open a snippet file and look at the syntax, it is pretty easy to create your own snippet depending on what you use the most.
I am currently on a promoting tour for UltiSnips on StackOverflow. UltiSnips supports extending other file types, your erb.snippets would look like this:
extends html, ruby, rails
snippet temp "A snippet only in Erb"
erb rules ${1}
endsnippet
A conversion script for snipMate snippets is shipped with UltiSnips, so switching is easy.
I used the autocommand method to the set the filetype, but then I got html syntax errors for things like this:
<%= image_tag("logo.png", :alt => "Sample App", :class => "round") %>
The last two angle brackets would be highlighted in red, which drove me bonkers. So, I created a symlink called eruby.snippets that points to html.snippets. That worked like a champ and now I don't have to make changes in two places. I also have an eruby-rails snippet directory for non-html eruby snippets.
This is on a Mac OS X system. Note that an alias won't work. You need to hit the terminal and use the ln command. Not sure about doing this on a Windoze system.
You can assign multiple snippets scopes to a single filetype. (I've found that altering the filetype tends to break some syntax highlighting).
You can check that the filetype for erb files is indeed 'eruby' with:
:set filetype?
If you're using the maintained fork of snipmate, it looks like you'll want both the eruby.snippets and eruby-rails.snippets from the snipmate-snippets repository (owned by honza, but I don't have enough reputation to link to it here) (see the INSTALL section of the snipmate README for proper setup).
If you are using the maintained fork, I believe setting g:snipMate.scope_aliases in your .vimrc with the following will work for your example:
let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['eruby'] = 'eruby,eruby-rails'
I've added a pull request to snipmate to have their documentation updated.
Jumping on the UltiSnips bandwagon after trying SnipMate for a while. Like SirVer mentioned, having the html, ruby, etc snippets available within an *.erb file was as simple as adding the extend line to the eruby.snippets file.
With the original snipMate plugin, create a file ~/.vim/ftplugin/erb_snippets.vim and put the following into it:
silent call ExtractSnipsFile(g:snippets_dir . 'html.snippets', &l:filetype)
silent call ExtractSnipsFile(g:snippets_dir . 'ruby.snippets', &l:filetype)

ASP.NET MVC IIS problem

I have this piece of code in a .cs file in an ASP.NET MVC application:
HtmlTableCell r2c1 = new HtmlTableCell();
r2.Cells.Add(r2c1);
r2c1.ColSpan = 2;
r2c1.Style.Add("font", "1px arial");
r2c1.Style.Add("height", "10px");
r2c1.Style.Add("background-image", "url(/Content/Images/pagebgbottomwhite.jpg)");
r2c1.Style.Add("background-repeat", "repeat-x");
This works OK locally, but when I deploy my app using IIS 5 I don't see that picture.
How can I change that format of the URL so I can see it?
First off, you don't really want to have this kind of code in your presenter.
As for URL format, try Server.MapPath("~/Content/Images/pagebgbottomwhite.jpg");. And ensure that this file is indeed where it should be.
You really ought to be using CSS and defining a class that has these attributes. The url would then be relative to the location of the CSS file in the site: url(../Images/pagebgbottomwhite.jpg) -- assuming that your css file is in a sibling directory to Images. Then you would apply the CSS class to your element.
I also agree with Anton that, using MVC, this code should not be in your controllers/models, but rather in the view -- in which case you would not be using HtmlTableCell. In that case, and using pure CSS, it's simply a matter of creating the proper row in the table.
<tr><td class="bottom-row" colspan="2"></td></tr>
Confirm that this file (/Content/Images/pagebgbottomwhite.jpg) is deployed. Is it set not to copy or was it left behind in deployment.

How to apply custom ItemStyle.xsl to CQWP

I got a question about applying custom itemstyle.xsl to CQWP.
I extracted existing CQWP, renamed it, and uploaded to webpart gallery on a site collection.
The modified CQWP web part worked with no problem at all under default itemstyle.xsl
After that, i copied itemstyle.xsl, renamed it to customitemstyle.xsl, and uploaded it to 'XSL Style Sheet' folder under Style Library and published the xsl file.
Once i published the file, i opened modified CQWP (.webpart file) in SPD then made a change to get modified xsl file applied. the change is listed below;
<property name="ItemXslLink" type="string" />/Style Library/XSL Style Sheets/customitemstyle.xsl</property>
After i uploaded the new CQWP, I tried to add the CQWP to a page but got an error saying cannot add webpart and make sure it is correct web part file (.dwp or .webpart file) and make sure the xml is well formed xml.
Now I get stucked to resolve the error and apply custom itemstyle to CQWP.
Can anybody help me? Did I miss anything?
Any comments, guide and direction will be appreciated.
Thank you.
You've probably figured it out by now, but the XML you have provided in your post isn't valid.
The property element is closed twice:
<property name="ItemXslLink" type="string" />XSL path</property>
First with a />-tag and after that the </property>-tag.

Resources